ded / morpheus

A Brilliant Animator
504 stars 57 forks source link

Centralize animation loop for great justice #26

Closed danro closed 12 years ago

danro commented 12 years ago

Based on this idea: http://jsperf.com/centralized-animation-loop

Moved all tween frame event listeners to a single render loop. This is how my AS3 tweening engine works, and I've seen nice benchmark gains in the past. It should also have the added bonus of keeping multiple tweened properties in better sync (since we're not depending on multiple setTimeouts to fire at the same time).

danro commented 12 years ago

actually, there is one last race condition. hold plz.

danro commented 12 years ago

Ah that's better.

danro commented 12 years ago

Been doing some work with canvas / svg animation and I think perhaps we should change the 11ms to something closer to the 1000/60 mark. Raphael.js uses 16ms and D3.js uses 17ms. I'm leaning toward 17, because it gives mobile devices that much more time to draw before requesting the next frame. Thoughts?