play-co / timestep

GNU General Public License v3.0
16 stars 27 forks source link

animate leaks views when not starting an animation #25

Closed roosmaa closed 8 years ago

roosmaa commented 10 years ago

The current backend.canvas.animate leaks views when animation is not actually started.

One of suchs cases is when you want to be sure that the current animation for some view is cleared: animate(v).clear()

After running that line without any animations currently running, the view v is forever stored in the global group.

Either this behaviour should be documented, the animation only added to it's group when it has actually started?

rogueSkib commented 8 years ago

This was fixed during a refactor of animate; animators are now cached on their subjects so they will be garbage collected with them. Groups no longer hang onto animators permanently, only while they are active. There are also some nicer API's to pause, resume, clear, and commit against both groups and subjects. https://github.com/gameclosure/timestep/blob/master/src/ui/backend/canvas/animate.js