Skip to the page

CSS in real projects · mid

Animations and their performance

Use transitions for state changes and @keyframes for loops, animate only transform and opacity for smooth 60fps motion, and respect prefers-reduced-motion.

The notes

What you must know

  • transition: property duration easing; @keyframes + animation for sequences.
  • transform and opacity can run on the compositor; width, height, top, left trigger layout every frame.
  • @media (prefers-reduced-motion: reduce) to reduce or remove motion.
  • View Transitions API (document.startViewTransition, and cross-document) animates between states or pages.

The red pen

Common traps: mistake → fix

  • Mistake: "CSS animations are always smooth"

    Fix: animating layout properties janks on slow devices.

Easy to hard

Questions interviewers ask, easy to hard

  1. How do you make an animation smooth?
  2. Transition vs animation?
  3. How do you respect users who get motion sick?

Explain it out loud

Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.

Practise by voice

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview