Sunday 15 July 2012

javascript - How can I use requestAnimationFrame for animating by changing css clases? -


I have 4 different classes, suppose .go1, .g2, .go3 and .go4. For example:

  Duration Transition: All .25s ease-in-out span.go1 Transformation: Translation (44px, 39px); Span.go2 conversion: translation (60px, 71px);   

I want to animate the span element by changing the classes, I can do this with set interval, but I am wondering if it can be done using requestAnimationFrame and In this case how to use it.

requestAnimationFrame

can not be , requestAnimationFrame is not a good option in this case.

The RAF will attempt to update each screen vblank (this will try to update the next vblank when you use it this way) which will be very fast to change the sections on an element. It's very bad It will take ... It will take time to complete an infection and call the RAF, when this is happening, there is no point because it has to wait until the end of the transition.

View animations and keys with CSS 3:

and commented events like this ( transitionend or webkitTransitionEnd Webkit) that allows you to trigger your next transition event has been triggered.

No comments:

Post a Comment