The animationstart event fires when a CSS Animation begins. Learn addEventListener vs onanimationstart, how animation-delay (including negative delay) affects elapsedTime, and how it leads into animationiteration / animationend—with five examples and try-it labs.
01
Kind
Instance event
02
Type
AnimationEvent
03
When
Animation begins
04
Handler
onanimationstart
05
Delay
Fires after delay
06
Status
Baseline widely available
Fundamentals
Introduction
As soon as a CSS animation is ready to play—after any positive animation-delay—the browser fires animationstart. Use it to mark UI as “playing,” disable a button, or prepare the next step in a motion sequence.
MDN: with a negative delay, the event still fires, and elapsedTime equals the absolute value of the delay. The animation begins partway through its keyframes, as if it had already been running.
💡
Beginner tip
Prefer addEventListener("animationstart", ...) so you can attach multiple handlers and remove them cleanly. The onanimationstart property is fine for quick demos.
Concept
Understanding animationstart
An instance event on elements that begin a CSS Animation. It answers: “Has this animation started playing?”
Fires when the animation starts (after a positive delay, if any).
elapsedTime is usually 0; with negative delay it is -1 * delay.
AnimationEvent — includes animationName, elapsedTime, pseudoElement.
Baseline Widely available on MDN (since December 2019).
Foundation
📝 Syntax
Use the event name with addEventListener, or set the handler property:
The negative-delay animation starts immediately (mid-sequence) with a non-zero elapsedTime. The positive-delay animation waits, then starts with elapsedTime: 0.
Example 5 — Full Lifecycle Log
Inspired by MDN’s live example: log start, iteration, end, and cancel together.
animationstart is marked Baseline Widely available on MDN (since December 2019). Logos use the shared browser-image-sprite.png sprite from this project. Pair it with animationend and animationiteration for full lifecycle handling.
✓ Baseline · Widely available
Element animationstart
Works across modern desktop and mobile browsers when a CSS animation begins.
100%Widely available
Google ChromeSupported · Desktop & Android
Full support
Mozilla FirefoxSupported · Desktop & Android
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
OperaSupported · Modern versions
Full support
Internet ExplorerLegacy support with prefixes in older IE
Partial
animationstartBaseline
Bottom line: Safe to use for UI that reacts when a CSS animation begins. Remember delay changes when the event fires and what elapsedTime reports.
Wrap Up
Conclusion
animationstart is the “playback began” signal for CSS Animations. Listen with addEventListener, account for delays in timing and elapsedTime, then pair with iteration/end/cancel for the full story.
Check event.animationName when multiple animations share a node
Account for positive delays before expecting the event
Read elapsedTime when using negative delays
Also handle animationend / animationcancel for cleanup
❌ Don’t
Assume the event fires before a positive delay ends
Assume elapsedTime is always zero
Confuse CSS animationstart with Web Animations API play events
Overwrite onanimationstart if you need multiple listeners
Forget infinite animations never fire animationend
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about animationstart
The CSS animation has begun—update UI and watch the lifecycle.
5
Core concepts
▶️01
Means begun
playback starts
Event
🎬02
AnimationEvent
name + time
API
⏱️03
Respect delay
wait or skip
Timing
🔔04
addEventListener
preferred
Listen
🎯05
Baseline
widely available
Compat
❓ Frequently Asked Questions
It fires when a CSS Animation has started. If there is an animation-delay, the event fires after that delay expires. With a negative delay, the event still fires and elapsedTime equals the absolute value of the delay.
No. MDN marks Element animationstart as Baseline Widely available (since December 2019). It is not Deprecated, Experimental, or Non-standard.
An AnimationEvent. Useful read-only properties include animationName, elapsedTime, and pseudoElement.
Use element.addEventListener("animationstart", handler) or set element.onanimationstart = handler. Prefer addEventListener when you need multiple handlers or easy removal.
Usually 0.0. If animation-delay is negative, elapsedTime is (-1 * delay) — for example a delay of -0.5s yields elapsedTime 0.5, and the animation begins partway through its sequence.
animationstart is first. Then you may get animationiteration between loops, animationend when the full run completes, or animationcancel if the animation aborts early.
Did you know?
Negative animation-delay is a common trick to start an infinite spinner or carousel “already in motion.” animationstart still fires, but elapsedTime tells you how far into the timeline you jumped.