Open kaevupoiss opened 2 years ago
Hey yes you could well be right here, it's been a while since I've played around with this but I do remember there being some lag at times. Does it run better if you change this around?
On Fri, 1 Apr 2022, 12:53 pm Rasmus Talioja, @.***> wrote:
I am a Canvas beginner and I was using your portfolio's canvas code as a great example for my idea. I came across a bug where my animation was awfully slow.
Please correct me if I am wrong. Your code seems to generate a new set of unused Dots just to animate the first set.
function createDots() { ctx.clearRect(0, 0, canvas.width, canvas.height); for (let i = 0; i < dots.nb; i++) { // This loop seems to run every frame. dots.array.push(new Dot()); var dot = dots.array[i];
dot.create();
}
...
dot.animate();} const draw = setInterval(createDots, 1000 / 30);
— Reply to this email directly, view it on GitHub https://github.com/bscottnz/portfolio-site/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF4B65JQK2K75DS7LFHTDSDVCY3GFANCNFSM5SHBPPCA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
I am a Canvas beginner and I was using your portfolio's canvas code as a great example for my idea. While your animation is running great I came across a bug where my animation was awfully slow.
Please correct me if I am wrong. Your code seems to generate a new set of unused Dots just to animate the first set.