[csswg-drafts] [web-animations-1] Animate - Add more event handlers (#6166)

glenn2223 has just created a new issue for https://github.com/w3c/csswg-drafts:

== [web-animations-1] Animate - Add more event handlers ==
Ref: https://drafts.csswg.org/web-animations-1/#the-animation-interface

Could these proposed event handlers be added to the Animation interface?

### **`onstart`**
**Example/proposal:** https://jsfiddle.net/glenn2223/gj7heoLv/

**Details**  
The event handler for each time the animation starts

**Reason**  
In case someone wants to change the state it starts, as they can currently do when it finishes.  
Currently, as per the example, setting any state before the calling `play()` causes issues when there is a `delay` or `endDelay`

---

### **`onFirstKeyFrame`** - possible handler. Maybe a higher preference to the `onKeyFrame` handler?
**Details**  
This would fire on (or just before) the first frame being initiated

**Reason**  
To fire an event the second that the animation actually starts (after delays)

---

### **`onLastKeyFrame`** - possible handler. Maybe a higher preference to the `onKeyFrame` handler?
**Details**  
This would fire on (or just before) the first frame being initiated

**Reason**  
To fire an event the second that the animation actually starts (after delays)

---

### **`onKeyFrame (index: number)`**
**Proposal:** https://jsfiddle.net/glenn2223/uwg589Lx/

**Details**  
This would fire on each keyframe that is hit, passing the index of the keyframe

**Reason**
You can fire events at certain stages of the animation process as per the details in the proposal link just above.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6166 using your GitHub account


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

Received on Wednesday, 31 March 2021 12:14:42 UTC