web-animations / web-animations-js-legacy

The original emulator of the Web Animations specification. Please use web-animations-js instead:
https://github.com/web-animations/web-animations-js
Apache License 2.0
707 stars 84 forks source link

How to destroy an animation at the end of its life? #627

Open joeytwiddle opened 10 years ago

joeytwiddle commented 10 years ago

For example I had an animation with iterations: Infinite, or I had an animation I was manually retriggering, but now I no longer need it.

I assume I should indicate that the animation is no longer wanted by doing:

animation.player.cancel();

But I am experiencing two issues:

(For the first case, I experimented with clearing inactive targets from the Compositor, but this is not complete: I still have to call _deregisterFromTimeline() myself.)

Should we be trying to cleanup _animProperties and isAffectedProperty when an animation is cancelled? (There is already a TODO that mentions we should try to cleanup the global PLAYERS list.)

I wonder if isAffectedProperty is redundant, given the existence of _animProperties. Is there any reason we can't peek at target._animProperties when we want to determine if a property is affected?

dstoc commented 10 years ago

I assume I should indicate that the animation is no longer wanted by doing:

animation.player.cancel();

This certainly should be sufficient.

@alancutter can probably look at the details here.

We're in the process of transitioning to a new version of the polyfill, might be worth taking a look at your use cases there too: https://github.com/web-animations/web-animations-next

joeytwiddle commented 10 years ago

OK, thanks for the tip. I will stop tweaking this library, and start tweaking your new one! :D

shans commented 10 years ago

It's important to know that there are currently a number of features missing from the new library:

We will implement all of this in time (and pull requests are welcome, of course :-D), but if you need these features now then the new version won't work for you yet. On the other hand, we do intend to deprecate the old library as soon as we can reasonably do so.

Cheers, -Shane

On Wed, Jul 30, 2014 at 7:54 PM, joeytwiddle notifications@github.com wrote:

OK, thanks for the tip. I will stop tweaking this library, and start tweaking your new one! :D

— Reply to this email directly or view it on GitHub https://github.com/web-animations/web-animations-js/issues/627#issuecomment-50595311 .

joeytwiddle commented 10 years ago

Thanks so much, I was wondering about the status. You could consider adding your status list to the README.md of web-animations-next, for other curious consumers.

I do need some of those features, but I will watch and experiment with the new project for now anyway.