Re: [csswg-drafts] [web-animations] how to make animate() method work with CSSKeyframesRule object? (#10570)

> I think you should use [`element.getAnimations()`](https://drafts.csswg.org/web-animations-1/#ref-for-dom-animatable-getanimations):

The `element.getAnimations()` method returns [only the scheduled or running animations on the element](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAnimations). Even if you've applied an animation to an element in CSS using `animation` property, once the animation completes you can't get reference of it using the `getAnimations()` method.

My issue is that Web Animation APIs work with POJO inputs and current CSS API returns objects like [CSSKeyframesRule](https://developer.mozilla.org/en-US/docs/Web/API/CSSKeyframesRule). _Objects returned by CSS APIs are not compatible with Web Animation APIs_. 

What I am asking is that either the **CSSKeyframesRule class to have a `deserialize()` like method that will return Web Animation compatible plain objects** or **The Web Animation API to accept CSS API returned objects**. This will save us from converting a lot of animations defined in CSS to JS.

> 1. Referencing a keyframe object by name where a keyframe object param is accepted.

:+1: This would be the best thing as it would save us from retrieving and converting the keyframes.

> 2. A way to get a map of enumerated keyframe objects by their name.

This is nice to have, but the returned objects need to be POJOs compatible with the Web Animations API.

-- 
GitHub Notification of comment by OnkarRuikar
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10570#issuecomment-2227210634 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Sunday, 14 July 2024 06:19:08 UTC