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 从公开仓库中收录这些内容。

举报或申请下架