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

Function animationLoop

assets/js/MouseTrails.js:35–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33
34// animating the ball generation process
35function animationLoop() {
36 ctx.clearRect(0, 0, w, h);
37 if (mouse.x !== undefined && mouse.y !== undefined) {
38 balls.push(new Ball());
39 }
40 if (balls.length > 200) {
41 balls = balls.slice(1);
42 }
43 drawBalls();
44 requestAnimationFrame(animationLoop);
45}
46
47// function to show balls on canvas
48function drawBalls() {

Callers 1

initFunction · 0.85

Calls 1

drawBallsFunction · 0.85

Tested by

no test coverage detected