Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Possible to get an animation's progress with JS? #177

Closed
mattfordham opened this Issue · 4 comments

2 participants

@mattfordham

For example, if I were wanting to animate something else with Javascript (like a number counting up or an image sequence's current frame) while an animation is running. Would this be possible with some kind of callback?

Thanks!

@Prinzhorn
Owner

There are only beforerender and render callbacks https://github.com/Prinzhorn/skrollr#beforerender

skrollr.init({
    render: function(data) {
        console.log(data.curTop);
    }
});

But I guess that's not the progress you're looking for, right?

@mattfordham

That would give you the progress of the overall page's scroll, right? What I'm looking for is the progress of an individual element's animation. In your opinion, would there be any big reason one couldn't/shouldn't add a callback for that?

@Prinzhorn
Owner

In your opinion, would there be any big reason one couldn't/shouldn't add a callback for that?

Performance. 60 callbacks per second per element.

And you can easily do this on your own. I mean, render gives you the scroll position. And you know which keyframes you added to an element. Just calculate the progress.

@mattfordham

Makes sense. Thanks for your thoughts on the matter!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.