State Changes

dylantarre/animation-principles/skills/05-by-animation-type/state-changes

by dylantarre83597134ba8fNo license99 starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated 9 months ago

Use when elements transform in place - toggle switches, expanding accordions, checkbox animations, button states, or any transformation without entering/exiting.

Instructions onlyDesign & Creative
AI-generated overview

Guides in-place UI state-change animations using Disney's 12 principles, with timing tables and CSS patterns.

What it does
This skill provides guidance for animating UI elements that transform in place, such as toggles, accordions, checkboxes, tabs and button states. It maps Disney's 12 animation principles onto these interactions and gives timing and easing recommendations per component. It also includes CSS implementation patterns for toggles and accordions, and stresses that state changes should be reversible.
When to use it
Use it when designing or implementing animations for elements that change state without entering or leaving the screen. It suits toggles, expanding accordions, checkbox and radio animations, tab switches and button states.
Requirements
No scripts or tools are required; it is an instructions-only reference. Applying the CSS patterns assumes a project that supports CSS transitions.

State Change Animations

Apply Disney's 12 principles when elements transform without leaving.

Principle Application

Squash & Stretch: Elements compress before expanding. A toggle switch squashes 5% before sliding.

Anticipation: Wind up before the change. Slight reverse movement (2-3px) before expanding.

Staging: Keep transformations centered on user focus. Don't let state changes distract from the interaction point.

Straight Ahead vs Pose-to-Pose: Define exact states. Button has rest, hover, active, disabled - each precisely designed.

Follow Through & Overlapping: Parts transform at different rates. Icon rotates before label fades in.

Slow In/Slow Out: Use ease-in-out for bidirectional changes: cubic-bezier(0.4, 0, 0.2, 1).

Arcs: Rotating elements follow natural arcs. Chevrons rotate on their center point, not linearly.

Secondary Action: Pair the primary change with supporting motion. Toggle sliding + color shift + icon swap.

Timing:

  • Micro-states: 100-150ms (checkbox tick, radio fill)
  • Standard states: 150-250ms (toggles, accordions)
  • Complex states: 250-400ms (multi-part transformations)

Exaggeration: Overshoot slightly on state changes. Toggle goes 2px past, then settles.

Solid Drawing: Maintain element integrity during transformation. No distortion that breaks visual consistency.

Appeal: State changes should feel satisfying. Users clicked with intent - reward that intent.

Timing Recommendations

State ChangeDurationEasingNotes
Checkbox150msease-outTick draws in
Toggle Switch200msease-in-outOvershoot slightly
Radio Button150msease-outScale in from center
Accordion250msease-in-outHeight + rotation
Tab Switch200msease-in-outIndicator slides
Button Active100msease-outScale to 0.97
Card Expand300msease-in-outAll properties together

Implementation Pattern

css
.toggle {  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);}
.toggle-knob {  transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1); /* Overshoot */}
.toggle.active .toggle-knob {  transform: translateX(20px);}

Accordion Pattern

css
.accordion-content {  display: grid;  grid-template-rows: 0fr;  transition: grid-template-rows 250ms ease-in-out;}
.accordion.open .accordion-content {  grid-template-rows: 1fr;}

Key Rule

State changes are reversible. The animation to state B should be the inverse of animation to state A. Test both directions.

Source and attribution

Source:dylantarre/animation-principlesinskills/05-by-animation-type/state-changesat commit8359713

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal