Animation:id 属性
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2020年3月.
Web 动画 API 的 Animation.id 属性用于获取或设置一个用于标识动画的字符串。
值
一个可用于标识动画的字符串;如果动画没有 id,则为 null。
示例
在红皇后的赛跑游戏示例中,你可以像下面这样为 redQueenAlice 分配一个 id:
js
redQueenAlice.id = "redQueenAlice";
规范
| Specification |
|---|
| Web Animations> # dom-animation-id> |
浏览器兼容性
Loading…