MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / animate

Function animate

assets/js/phyllotaxis.js:24–50  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22}
23
24function animate() {
25
26
27 let r = c * Math.sqrt(n);
28 let angle = n * 137.5 * (Math.PI / 180);
29
30 let dis = (h > w) ? w : h;
31
32 if (r < dis / 2 - 10) {
33
34 let x = r * Math.cos(angle);
35 let y = r * Math.sin(angle);
36 let h = (n % 255) / 2;
37
38 ctx.fillStyle = "hsl(" + 1 + h + ",80%,50%)";
39 ctx.strokeStyle = "white";
40 ctx.lineWidth = this.z / 2;
41 ctx.beginPath();
42 ctx.arc(x, y, c / 2, 0, Math.PI * 2);
43 ctx.fill();
44 ctx.closePath();
45
46 n++;
47 requestAnimationFrame(animate);
48 }
49
50}
51

Callers 1

initFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected