I'm wondering is there any difference in performance of using CSS Transitions vs. any of the various JavaScript animation libraries? (script.aculo.us
, scripty2
, jsAnim
, MooTools
, $fx
, etc).
I've tried various tests in Safari and Chrome but I don't actually see any difference. I thought that CSS Transitions were supposed to be hardware accelerated.
Update:
I've tried using Scriptaculous' Effect.Fade
on 5 different DIVs (each containing a canvas with some lines). Doing the exact same thing using CSS transitions, I see absolutely no difference in performance. Both were very smooth with one DIV/Canvas, but both are very slow when I do more than 2 at a time.
I've tried this in Safari 4, 5 (OSX), Google Chrome 5 and FireFox 3.7pre. Same results across the board.
In answer to UpHelix's response, you're not simply limited to hover
, etc. You can trigger a transition by changing any transitionable
style. For instance, set the opacity of an element in JavaScript (after, you've specified the transitionPropery
and transitionDuration
for that element).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…