state-changes

GitHub

提供UI元素原地状态变换(如开关、手风琴)的动画设计指南,涵盖迪士尼12原则及CSS实现细节。

skills/05-by-animation-type/state-changes/SKILL.md dylantarre/animation-principles

Trigger Scenarios

需要为交互组件添加平滑过渡效果 询问CSS transition或animation的具体参数配置 优化按钮、复选框等微交互体验

Install

npx skills add dylantarre/animation-principles --skill state-changes -g -y
More Options

Non-standard path

npx skills add https://github.com/dylantarre/animation-principles/tree/main/skills/05-by-animation-type/state-changes -g -y

Use without installing

npx skills use dylantarre/animation-principles@state-changes

指定 Agent (Claude Code)

npx skills add dylantarre/animation-principles --skill state-changes -a claude-code -g -y

安装 repo 全部 skill

npx skills add dylantarre/animation-principles --all -g -y

预览 repo 内 skill

npx skills add dylantarre/animation-principles --list

SKILL.md

Frontmatter
{
    "name": "state-changes",
    "description": "Use when elements transform in place - toggle switches, expanding accordions, checkbox animations, button states, or any transformation without entering\/exiting."
}

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 Change Duration Easing Notes
Checkbox 150ms ease-out Tick draws in
Toggle Switch 200ms ease-in-out Overshoot slightly
Radio Button 150ms ease-out Scale in from center
Accordion 250ms ease-in-out Height + rotation
Tab Switch 200ms ease-in-out Indicator slides
Button Active 100ms ease-out Scale to 0.97
Card Expand 300ms ease-in-out All properties together

Implementation Pattern

.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

.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.

Version History

  • 8359713 Current 2026-12-03 14:20

Same Skill Collection

skills/01-by-domain/3d-spatial/SKILL.md
skills/01-by-domain/accessible-motion/SKILL.md
skills/01-by-domain/brand-marketing/SKILL.md
skills/01-by-domain/data-visualization/SKILL.md
skills/01-by-domain/game-development/SKILL.md
skills/01-by-domain/micro-interactions/SKILL.md
skills/01-by-domain/mobile-touch/SKILL.md
skills/01-by-domain/page-transitions/SKILL.md
skills/01-by-domain/presentations/SKILL.md
skills/01-by-domain/universal-fallback/SKILL.md
skills/01-by-domain/video-motion-graphics/SKILL.md
skills/01-by-domain/web-motion-design/SKILL.md
skills/02-by-thinking-style/anticipation-payoff/SKILL.md
skills/02-by-thinking-style/attention-direction/SKILL.md
skills/02-by-thinking-style/character-appeal/SKILL.md
skills/02-by-thinking-style/emotional-narrative/SKILL.md
skills/02-by-thinking-style/exaggerated-clarity/SKILL.md
skills/02-by-thinking-style/naturalistic-motion/SKILL.md
skills/02-by-thinking-style/physics-intuition/SKILL.md
skills/02-by-thinking-style/problem-diagnosis/SKILL.md
skills/02-by-thinking-style/rhythm-pacing/SKILL.md
skills/02-by-thinking-style/spatial-thinking/SKILL.md
skills/02-by-thinking-style/timing-mastery/SKILL.md
skills/02-by-thinking-style/universal-mindset/SKILL.md
skills/03-by-role-persona/accessibility-advocate/SKILL.md
skills/03-by-role-persona/animator-traditional/SKILL.md
skills/03-by-role-persona/brand-strategist/SKILL.md
skills/03-by-role-persona/creative-director/SKILL.md
skills/03-by-role-persona/educator-teacher/SKILL.md
skills/03-by-role-persona/filmmaker/SKILL.md
skills/03-by-role-persona/frontend-developer/SKILL.md
skills/03-by-role-persona/game-designer/SKILL.md
skills/03-by-role-persona/motion-designer/SKILL.md
skills/03-by-role-persona/product-manager/SKILL.md
skills/03-by-role-persona/universal-practitioner/SKILL.md
skills/03-by-role-persona/ux-researcher/SKILL.md
skills/04-by-skill-level/absolute-beginner/SKILL.md
skills/04-by-skill-level/advanced/SKILL.md
skills/04-by-skill-level/deep-dive/SKILL.md
skills/04-by-skill-level/expert/SKILL.md
skills/04-by-skill-level/intermediate/SKILL.md
skills/04-by-skill-level/master/SKILL.md
skills/04-by-skill-level/novice/SKILL.md
skills/04-by-skill-level/quick-start/SKILL.md
skills/04-by-skill-level/refresher/SKILL.md
skills/04-by-skill-level/teaching-others/SKILL.md
skills/04-by-skill-level/troubleshooting/SKILL.md
skills/04-by-skill-level/universal-reference/SKILL.md
skills/05-by-animation-type/attention-grabbers/SKILL.md
skills/05-by-animation-type/continuous-loops/SKILL.md

Metadata

Files
0
Version
8359713
Hash
f6a65edc
Indexed
2026-12-03 14:20

홈 - 위키
Copyright © 2011-2026 iteam. Current version is 2.156.0. UTC+08:00, 2026-12-03 17:39
浙ICP备14020137号-1