<button onclick="drawSpiral()">Draw Spiral</button>
<canvas height="400" id="canvas" width="400">
</canvas>
<script>
// Get the canvas element and its context
function drawSpiral() {
const canvas = document.querySelector('#canvas');
if (!canvas.getContext) {
return;
}
const ctx = canvas.getContext('2d');
// set line stroke and line width
ctx.strokeStyle = 'red';
ctx.lineWidth = 5;
// draw a red line
a=0;r=0;i=0, n=4*2*Math.PI,dr=0.05,x0=200,y0=200;
ctx.beginPath();
ctx.moveTo(x0, y0);
for(a=0;a<n;a+=0.01){
ctx.lineTo(200+r*Math.cos(a), 200+r*Math.sin(a));
r+=dr;
}
ctx.stroke();
}
</script>
Computer Methods in Science Course
Friday, October 13, 2023
Subscribe to:
Post Comments (Atom)
NaCl.xyz Generator with Interactive 3D Visualization
NaCl.xyz Generator with Interactive 3D Visualization NaCl.xyz Generator with Interactive 3D Visualization ...
-
In mathematics, Pascal's triangle is a triangular array of the binomial coefficients Coasters (Set of 4) $13.91 #MOVING #EYE #ILLUSION #...
-
Cognitive Science Hexagon - научные направления, которые способствовали зарождению когнитивной наукиActive T-Shirt $25.00 Baseball ¾ Sleeve T-Shirt $25.20 Classic T-Shirt $19.90 Graphic T-Shirt $28.22 Lightweight Hoodie $34.85 Lightweight S...
-
Get my art printed on awesome products. Support me at Redbubble Unit #circle #angles. #Trigonometry, #Math Formulas, Geometry Formu...
No comments:
Post a Comment