Skip to content

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

@joeytwiddle

Description

@joeytwiddle

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions