Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
joeytwiddle opened this issue Jul 28, 2014 · 4 comments
Open

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

joeytwiddle opened this issue Jul 28, 2014 · 4 comments

Comments

@joeytwiddle
Copy link

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:

  • The style properties are still being written on each tick by applyAnimatedValues() because they are still listed in _animProperties.
  • Even when all the animations are cancelled, the element's style has been masked by an AnimatedCSSStyleDeclaration and if I write style properties, they are not set in the DOM because they are still listed in isAffectedProperty.

(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
Copy link
Contributor

dstoc commented Jul 29, 2014

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
Copy link
Author

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

@shans
Copy link
Contributor

shans commented Jul 30, 2014

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

  • you can animate transforms (but there's no matrix fallback), lengths,
    colors and numbers
  • only simple (non-iterating, non-eased) groups are supported
  • only replace animations are supported

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 [email protected]
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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants