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

Web Animations API #36

Open
Martin-Pitt opened this issue Jun 4, 2015 · 1 comment
Open

Web Animations API #36

Martin-Pitt opened this issue Jun 4, 2015 · 1 comment

Comments

@Martin-Pitt
Copy link

Hi @Rich-Harris,

Would it be possible to create a ramjet that can rely entirely on the web animations api? It would be great to be able to make ramjets of different elements and composite them into one big animation, e.g:

var anim = new AnimationSequence([
  ramjet.transform(document.querySelector('button.nav.active'), document.querySelector('header.page')),
  new Animation(document.querySelector('img.avatar'), [ { transform: 'translateX(300px) rotate(30deg) translateX(-400px) } ])
], { duration: 500, fill: 'forwards' });

var player = document.timeline.play(anim);
player.play();

The Web Animations API polyfill is used by Polymer for example and works really well, providing cross-browser support.
https://github.com/web-animations/web-animations-js

@Rich-Harris
Copy link
Owner

I did wonder about using web animations under the hood. As an internal implementation detail, it didn't really make sense as there are no performance benefits over CSS animations (as far as I can see), while the polyfill introduces a severe penalty because the animations are timer-based IIRC and have to run on the main thread.

But you make an interesting case about composition. I was planning to (eventually) make ramjet.transform return an object with things like pause and reverse methods - perhaps it would make more sense if that object was compatible with the web animations API. Definitely worth looking into for a future release

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

No branches or pull requests

2 participants