State Changes

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

作者 dylantarre83597134ba8f無授權條款99 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫9 個月前更新

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

僅含說明Design & Creative
AI 產生的概覽

運用迪士尼十二項動畫原則指導原地狀態變化動畫,並提供時長表與 CSS 模式。

功能
這項技能為原地變換的介面元素提供動畫指引,例如開關、摺疊面板、核取方塊、分頁與按鈕狀態。它把迪士尼十二項動畫原則對應到這些互動上,並針對各元件給出時長與緩動建議。它也包含開關與摺疊面板的 CSS 實作模式,並強調狀態變化應該可逆。
適用情境
適用於為不進入或離開畫面、只改變狀態的元素設計或實作動畫時。適合開關、展開式摺疊面板、核取方塊與選項按鈕動畫、分頁切換以及按鈕狀態。
執行需求
不需要指令碼或工具,僅為純說明性參考。套用其中的 CSS 模式需要專案支援 CSS 轉場。

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.

來源與署名

來源:dylantarre/animation-principles位於skills/05-by-animation-type/state-changes提交8359713

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架