Why is animation speed increasing each time the target element is deleted
and recreated?
I've created a jQuery plugin based on somebody else's Chrome experiment
that inserts a canvas element into your target element, and draws an
interactive starfield in the canvas.
Each time you resize the window, the canvas element is removed and then
restored so that its size matches its parent element and everything
animates properly; it's responsive.
However, whenever it's restored, the speed of the animation increases. Why
does it do this? I thought all the variables (including speed) were reset
to their defaults with the this.start() method.
You can see the code (and demo) on CodePen; you can also fork it on
Github, though I think the Github version is several commits behind my
own.
(Also, this is my first real jQuery plugin, so if you see any issues, by
all means, let me know.)
Any clues?
No comments:
Post a Comment