8000 [css-view-transitions-2] Allow rAF/script based animations with view transitions. · Issue #8132 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

[css-view-transitions-2] Allow rAF/script based animations with view transitions. #8132

@khushalsagar

Description

@khushalsagar

View Transitions keep the pseudo DOM state alive until there is an active animation on any of the generated pseudo-elements. This is fine if the author is using CSS or Web Animations, but not if the animation is driven by script using rAF or setTimeout.

We can add an API as follows which allows the author to pass a promise indicating when a custom script driven animation has finished.

function animateHeader(transition) {
  transition.waitUntil((async () => {
    // animate the header here, and return when done
  })());
}

async function startAnimations(transition) {
  await transition.ready;
  animateHeader(transition);
  animateFooter(transition);
  animateThumbnail(transition);
}

credits to @jakearchibald for the API suggestion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0