Animation skill · Mobile
SwiftUI motion
Springs, matched geometry, keyframes and haptics on iOS.
Give this skill to your AI agent
Run this in your project. Claude Code picks it up from .claude/skills; for other agents, paste the file into their rules.
mkdir -p .claude/skills/swiftui-motion && curl -fsSL https://kitesmotion.com/skills/swiftui-motion/SKILL.md -o .claude/skills/swiftui-motion/SKILL.mdUse SwiftUI's built-in animation system first; it is interruptible and handles accessibility.
Defaults
withAnimation(.snappy)for quick state changes..smoothfor layout changes,.bouncysparingly.- Custom:
.spring(response: 0.35, dampingFraction: 0.85).
Shared elements
swift@Namespace private var ns
CardView().matchedGeometryEffect(id: item.id, in: ns)Use the same id in both states and wrap the state change in withAnimation.
Multi-step animations
PhaseAnimatorfor simple loops through states.KeyframeAnimatorfor timed tracks (scale, rotation, offset) like a bounce or shake.
Transitions
.transition(.move(edge: .bottom).combined(with: .opacity))for sheets and toasts..contentTransition(.numericText())for numbers..symbolEffect(.bounce, value: count)and.contentTransition(.symbolEffect(.replace))for SF Symbols.
Scroll
.scrollTransition { content, phase in content.scaleEffect(phase.isIdentity ? 1 : 0.92).opacity(phase.isIdentity ? 1 : 0.6) }.scrollTargetBehavior(.viewAligned)for paging carousels.
Haptics
.sensoryFeedback(.selection, trigger: value), .success on completion, .impact(weight: .light) on snaps.
Performance
- Use
.drawingGroup()for heavy layered drawing. - Use
CanvaswithTimelineView(.animation)for particles. - Avoid animating
frameon large lists; animateoffsetandscaleEffect.
Accessibility
Read accessibilityReduceMotion and fall back to opacity changes.