CSS Transitions & Keyframe Animations

Hover over the boxes and cards to see the effects.

Part 1 - Hover Transitions (4 different properties)

Color
ease
Scale
cubic
Radius
ease-in-out
Lift
ease-out

Box 1: background-color + color (ease) | Box 2: scale (cubic-bezier) | Box 3: border-radius morph (ease-in-out) | Box 4: translateY + shadow (ease-out)

Part 2 - @keyframes spin (infinite 360 degree loop)

Uses linear timing so the speed is constant throughout. The spin keyframe goes from rotate(0deg) to rotate(360deg).

Part 3 - @keyframes bounce (5 keyframe stops)

bounce

Stops at 0%, 30% (air), 50% (squish on ground), 70% (small rebound), 100% (rest). Added scaleY to squish it when it hits the ground.

Part 4 - Hover-triggered wiggle animation (5 stops)

Hover me!

This card has a wiggle animation that plays when you hover over it. It uses 5 keyframe stops with translateX and rotate.

Wiggle has 5 stops: 0% (rest), 20% (left), 45% (right), 70% (left smaller), 100% (back to center).

Part 5 - animation-fill-mode: forwards

fill-mode: forwards

This badge slides in from the left and stays visible after the animation ends because of animation-fill-mode: forwards. Without it the badge would snap back to opacity 0.

Part 6 - Timing function comparison (hover each one)

ease

Default. Slow-fast-slow. Feels the most natural.

linear

Constant speed. Feels mechanical or robotic.

ease-in

Slow start then speeds up. Feels like launching.

ease-out

Fast start then slows. Feels like braking/floating.

ease-in-out

Slow on both ends. Smooth for longer transitions.

cubic-bezier

Custom spring curve. Overshoots then settles back.

steps(5)

Jumps in 5 steps. No smooth motion, like a film strip.