bendc / animateplus

A+ animation module for the modern web
MIT License
5.96k stars 280 forks source link

Add function on each iteration #2

Closed NetanelBasal closed 9 years ago

NetanelBasal commented 9 years ago

You can add a step callback function like $ does, A function to be called for each animated property of each animated element.

bendc commented 9 years ago

I've actually considered this but since I couldn't find many interesting use cases, I've decided to pass. Thanks anyway!

iamvdo commented 8 years ago

Hi. I find an interesting use case for this. When building Sticky Elements, I found an issue where I want to "pause" an animation on mouseover for example. Then on mouseleave, animation resumes from its actual position, not from the beginning. I can use getComputedStyle to retrieve transform values, but it forces a reflow/repaint so I'm trying to avoid that.

A step or each callback returning actual transforms and values would be really helpful. This way, I could update the DOM accordingly (I know the DOM is slow too) I've already tested that and it seems to work pretty well.