0
0
CSSmarkup~10 mins

Animation duration and delay in CSS - Browser Rendering Trace

Choose your learning style9 modes available
Render Flow - Animation duration and delay
Parse CSS animation properties
Calculate animation duration
Calculate animation delay
Schedule animation start
Render animation frames over time
Apply animation styles to element
Composite updated frames
The browser reads animation properties like duration and delay, calculates when and how long the animation runs, then renders frames accordingly over time.
Render Steps - 6 Steps
Code Added:animation-name: slide;
Before
[box]
Animate me
After
[box]
Animate me
The animation is named but not running yet, so no visible change.
🔧 Browser Action:Registers animation keyframes for the element.
Code Sample
A blue box moves right over 2 seconds, starting 1 second after page load.
CSS
<div class="box">Animate me</div>
CSS
@keyframes slide {
  from { transform: translateX(0); }
  to { transform: translateX(10rem); }
}
.box {
  width: 10rem;
  height: 5rem;
  background: #4a90e2;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  animation-name: slide;
  animation-duration: 2s;
  animation-delay: 1s;
  animation-fill-mode: forwards;
}
Render Quiz - 3 Questions
Test your understanding
After applying animation-delay: 1s (render_step 3), what does the box do?
AMoves slower but starts immediately
BStays still for 1 second before moving
CMoves immediately without delay
DDoes not move at all
Common Confusions - 3 Topics
Why doesn't the animation start immediately?
Because animation-delay is set to 1s, the browser waits 1 second before starting the animation (see render_steps 3).
💡 Delay pauses animation start; no movement until delay ends.
Why does the box stay moved after animation ends?
The animation-fill-mode: forwards keeps the element at the final keyframe style after animation finishes (see render_steps 6).
💡 Fill mode controls if animation styles stay or revert.
If I remove animation-duration, what happens?
Without duration, the animation defaults to 0s and won't visibly run (see render_steps 2 explanation).
💡 Duration must be set for animation to run visibly.
Property Reference
PropertyValueEffect on Animation TimingVisual EffectCommon Use
animation-duration2sSets how long animation runsControls speed of animationMake animation slower or faster
animation-delay1sSets wait time before animation startsDelays start of animationCreate pause before animation
animation-fill-modeforwardsKeeps final animation stateElement stays at end styleKeep animation effect visible after end
Concept Snapshot
animation-duration sets how long the animation runs (default 0s). animation-delay sets how long to wait before starting (default 0s). animation-fill-mode controls if the element keeps the final animation style. Animations start after delay, run for duration, then apply fill mode. Without duration, animation won't visibly run. Delay pauses start but does not affect speed.