All skills
rshankras avatar

/animation-patterns

@32566aa

SwiftUI animation patterns including springs, transitions, PhaseAnimator, KeyframeAnimator, SF Symbol effects, scroll-driven effects, mesh gradients, text renderers, and shader effects. Use when implementing, reviewing, or fixing animation or visual-effect code on iOS/macOS.

Use this Skill: https://skilld.dev/gh/rshankras/claude-code-apple-skills/animation-patterns

This session only. Nothing lands on disk.

SKILL.md

β‰ˆ74 tokens always: the name and description. β‰ˆ2.1k when used: this file. β‰ˆ14k more on demand in 5 files.

Animation Patterns

Correct API shapes and patterns for SwiftUI animations. Prevents the most common mistakes: mixed spring parameter generations, wrong PhaseAnimator/KeyframeAnimator closure signatures, and using matchedGeometryEffect where matchedTransitionSource is needed.

When This Skill Activates

Use this skill when the user:

  • Asks to add, fix, or review animation code
  • Mentions spring, bounce, or snappy animations
  • Wants view transitions (insertion/removal, hero, zoom)
  • Asks about PhaseAnimator or KeyframeAnimator
  • Wants SF Symbol effects (bounce, pulse, wiggle, breathe)
  • Mentions matchedGeometryEffect or matchedTransitionSource
  • Asks about reduce motion / animation accessibility
  • Wants to sequence or chain animations
  • Mentions withAnimation, animation completions, or Transaction
  • Wants scroll-driven effects (parallax, carousels, scrollTransition, visualEffect)
  • Mentions MeshGradient, TextRenderer, or Metal shader effects (colorEffect, distortionEffect, layerEffect)

Decision Tree

Choose the right reference file based on what the user needs:

What are you animating?
β”‚
β”œβ”€ A state change (opacity, position, color)
β”‚  └─ β†’ core-animations.md
β”‚     β”œβ”€ withAnimation { } β€” explicit animation
β”‚     β”œβ”€ .animation(_:value:) β€” implicit animation
β”‚     └─ Spring configuration β€” .spring, .bouncy, .snappy, .smooth
β”‚
β”œβ”€ A multi-step / sequenced animation
β”‚  └─ β†’ phase-keyframe-animators.md (PhaseAnimator)
β”‚     └─ Cycles through discrete phases automatically or on trigger
β”‚
β”œβ”€ A complex multi-property animation (scale + rotation + offset)
β”‚  └─ β†’ phase-keyframe-animators.md (KeyframeAnimator)
β”‚     └─ Timeline-based keyframes with per-property tracks
β”‚
β”œβ”€ A view appearing / disappearing
β”‚  └─ β†’ transitions.md
β”‚     β”œβ”€ .transition() β€” insertion/removal
β”‚     β”œβ”€ .contentTransition() β€” text/symbol changes
β”‚     └─ .asymmetric() β€” different in/out
β”‚
β”œβ”€ A hero / zoom navigation transition
β”‚  └─ β†’ transitions.md (matchedTransitionSource section)
β”‚     β”œβ”€ iOS 18+: matchedTransitionSource + .navigationTransition(.zoom)
β”‚     β”œβ”€ UIKit: preferredTransition = .zoom (capture stable IDs, never views)
β”‚     └─ iOS 14+: matchedGeometryEffect (NOT for NavigationStack)
β”‚
β”œβ”€ A UIKit view driven by SwiftUI state or gestures
β”‚  └─ β†’ transitions.md (Bridging UIKit and SwiftUI Animations)
β”‚     └─ UIView.animate(.spring(...)) / context.animate in updateUIView
β”‚
β”œβ”€ An SF Symbol animation
β”‚  └─ β†’ symbol-effects.md
β”‚     └─ .symbolEffect(.bounce), .pulse, .wiggle, .breathe, .rotate
β”‚
β”œβ”€ A scroll-driven, geometry-driven, or shader effect
β”‚  └─ β†’ visual-effects.md
β”‚     β”œβ”€ .scrollTransition β€” carousel scale/parallax/caption fades
β”‚     β”œβ”€ .visualEffect β€” position-based effects without GeometryReader
β”‚     β”œβ”€ MeshGradient β€” animatable multi-point gradients
β”‚     β”œβ”€ TextRenderer β€” per-line / per-glyph text animation
β”‚     └─ ShaderLibrary + .colorEffect / .distortionEffect / .layerEffect
β”‚
└─ Spring physics / timing configuration
   └─ β†’ core-animations.md (Spring Configurations section)

API Availability

API Minimum Version Reference
withAnimation iOS 13 core-animations.md
.animation(_:value:) iOS 13 core-animations.md
.spring(response:dampingFraction:) iOS 13 core-animations.md
.matchedGeometryEffect iOS 14 transitions.md
.transition(.push(from:)) iOS 16 transitions.md
.contentTransition(.numericText()) iOS 16 transitions.md
PhaseAnimator iOS 17 phase-keyframe-animators.md
KeyframeAnimator iOS 17 phase-keyframe-animators.md
.spring(duration:bounce:) iOS 17 core-animations.md
Spring presets (.bouncy, .snappy, .smooth) iOS 17 core-animations.md
withAnimation(_:completionCriteria:_:completion:) iOS 17 core-animations.md
.symbolEffect() iOS 17 symbol-effects.md
.transition(.blurReplace) iOS 17 transitions.md
.contentTransition(.symbolEffect(.replace)) iOS 17 transitions.md
Transition protocol / TransitionPhase iOS 17 transitions.md
TransactionKey, scoped .animation / .transaction variants iOS 17 core-animations.md
KeyframeTimeline, .mapCameraKeyframeAnimator iOS 17 phase-keyframe-animators.md
.scrollTransition, .visualEffect iOS 17 visual-effects.md
Shaders: .colorEffect / .distortionEffect / .layerEffect iOS 17 visual-effects.md
MeshGradient iOS 18 visual-effects.md
TextRenderer / TextAttribute iOS 18 visual-effects.md
.matchedTransitionSource iOS 18 transitions.md
.navigationTransition(.zoom) β€” push, sheet, fullScreenCover iOS 18 transitions.md
UIViewController.preferredTransition = .zoom iOS 18 transitions.md
UIView.animate(_: Animation) / context.animate iOS 18 transitions.md

Top 5 Mistakes β€” Quick Reference

# Mistake Fix Details
1 spring(response:bounce:) β€” mixing parameter generations Use either spring(response:dampingFraction:) (iOS 13) or spring(duration:bounce:) (iOS 17) core-animations.md
2 .animation(.spring()) without value: parameter Always pass value: β€” the no-value variant is deprecated (iOS 15) core-animations.md
3 Wrong PhaseAnimator closure signature PhaseAnimator(phases) { content, phase in } β€” not { phase in } phase-keyframe-animators.md
4 Using matchedGeometryEffect for NavigationStack transitions Use matchedTransitionSource + .navigationTransition(.zoom) on iOS 18+ transitions.md
5 Using withAnimation for SF Symbol effects Use .symbolEffect() modifier instead symbol-effects.md

Review Checklist

When reviewing animation code, verify:

  • Reduce motion β€” animations respect AccessibilityMotionEffect or UIAccessibility.isReduceMotionEnabled; provide non-motion alternatives
  • Duration limits β€” no animation exceeds ~0.5s for UI feedback; longer only for decorative/ambient effects
  • Spring vs linear β€” springs for interactive/physical motion; linear/easeInOut only for opacity fades or progress indicators
  • No deprecated APIs β€” .animation(.spring()) without value: is deprecated; .animation(nil) is replaced by withTransaction
  • Correct spring generation β€” parameter names match the same API generation (never mix response with bounce)
  • Completion handlers β€” using withAnimation(_:completionCriteria:_:completion:) (iOS 17+), not inventing .onAnimationCompleted
  • Transition scope β€” .transition() only affects views inside if/switch controlled by state; not for views that are always present
  • Per-frame closures stay cheap β€” KeyframeAnimator content closures, visualEffect closures, TextRenderer.draw, and Animatable view bodies run every frame; no allocation, formatting, or layout math inside

Reference Files

File Content
core-animations.md withAnimation, springs, completions, transactions + TransactionKey, timing curves, Animatable mechanics, fluid-interface principles (momentum projection, rubber-banding, hysteresis)
phase-keyframe-animators.md PhaseAnimator, KeyframeAnimator, KeyframeTimeline, MapKit camera keyframes, custom animations
transitions.md View transitions, custom Transition protocol, matched geometry, navigation/zoom transitions (SwiftUI + UIKit), interruptibility, UIKit↔SwiftUI bridging, gesture-driven springs
symbol-effects.md SF Symbol effects, accessibility
visual-effects.md scrollTransition, visualEffect, MeshGradient, TextRenderer, shader effects (colorEffect/distortionEffect/layerEffect), effect pipelines, semantic alignment guides

Source: SKILL.md on GitHub

No alerts2mo3 checks Β· Risk SAFE
  • Gen Agent Trust Hub2mo

    The skill is a comprehensive reference guide for SwiftUI animation patterns. It contains only instructional documentation and code snippets for Apple's native frameworks. No security issues were detected.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW Β· No issues

Signed by skilld at 32566aa. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 3 months ago
What it can do
Reads files
last_verified
2026-07-16
review_by
2027-06-22
os_version
iOS 27 / macOS 27
All 3 allowed tools
ReadGlobGrep

README badge

README badge for rshankras/claude-code-apple-skills/animation-patterns