- From: Guillaume via GitHub <sysbot+gh@w3.org>
- Date: Sat, 13 Jul 2024 09:19:57 +0000
- To: public-css-archive@w3.org
I think you should use [`element.getAnimations()`](https://drafts.csswg.org/web-animations-1/#ref-for-dom-animatable-getanimations):
```js
const box = document.querySelector("#target");
function playAnimation({ effect }) {
const keyframes = effect.getKeyframes();
const options = {
duration: 2000,
iterations: Infinity,
};
effect = new KeyframeEffect(box, keyframes, options);
const animation = new Animation(effect);
animation.play();
}
document.getAnimations().forEach(playAnimation);
```
--
GitHub Notification of comment by cdoublev
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10570#issuecomment-2226834361 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Saturday, 13 July 2024 09:19:58 UTC