← 返回 Skills 市场
anderskev

Ios Animation Implementation

作者 Kevin Anderson · GitHub ↗ · v1.2.1 · MIT-0
cross-platform ✓ 安全检测通过
229
总下载
0
收藏
1
当前安装
2
版本数
在 OpenClaw 中安装
/install ios-animation-implementation
功能描述
Write Swift animation code using Apple's latest frameworks — SwiftUI animations, Core Animation, and UIKit. Prefer first-party APIs over third-party librarie...
使用说明 (SKILL.md)

iOS Animation Implementation

Write animation code that uses Apple's frameworks directly. Third-party animation libraries add dependency risk and often lag behind new OS releases — Apple's APIs are well-optimized for the render pipeline and get free improvements with each iOS version.

Before Writing Custom Animation

Check whether the system already handles the motion you need. Apple's HIG: "Many system components automatically include motion, letting you offer familiar and consistent experiences throughout your app." System components also automatically adjust for accessibility settings and input methods — Liquid Glass (iOS 26) responds with greater emphasis to direct touch and produces subdued effects for trackpad. Custom animation can't match this adaptiveness for free, so prefer system-provided motion when it exists.

Skip custom animation when:

  • Standard navigation transitions cover your case (push, pop, sheet, fullScreenCover)
  • SF Symbol .symbolEffect provides the feedback you need
  • .contentTransition(.numericText) handles your data change
  • The system's default spring on withAnimation is sufficient

Write custom animation when:

  • The system doesn't provide the spatial relationship you need (hero transitions, custom gestures)
  • You need coordinated multi-property choreography
  • The animation is a signature moment that defines the app's identity
  • Gesture-driven interaction requires custom progress mapping

API Selection

Choose the right API for the job. Start with SwiftUI animations (simplest, most declarative), drop to UIKit when you need interactive control, and reach for Core Animation only when you need layer-level precision.

Need API Why
State-driven property changes withAnimation / .animation(_:value:) Declarative, automatic interpolation
Multi-step sequenced animation PhaseAnimator Discrete phases with per-phase timing
Per-property timeline control KeyframeAnimator Independent keyframe tracks per property
Hero transitions between views matchedGeometryEffect + Namespace Geometry matching across view identity
Navigation push/pop with zoom .navigationTransition(.zoom) iOS 18+ built-in zoom transition
Custom view insertion/removal Transition protocol conformance TransitionPhase-based modifier
In-view content swap .contentTransition() Numeric text, interpolation, opacity
Scroll-position-based effects .scrollTransition Phase-driven scroll-linked animation
SF Symbol animation .symbolEffect() Bounce, pulse, wiggle, breathe, rotate
Interactive/interruptible (UIKit) UIViewPropertyAnimator Pause, resume, reverse, scrub
Per-layer property animation CABasicAnimation / CASpringAnimation Shadow, border, cornerRadius animation
Complex choreography (layers) CAKeyframeAnimation + CAAnimationGroup Multi-property layer animation
Physics simulation UIDynamicAnimator Gravity, collision, snap, attachment
Haptic feedback paired with animation .sensoryFeedback modifier Tied to value changes
Animated background gradients MeshGradient 2D grid of positioned, animated colors

Implementation by Category

Detailed patterns and code examples live in the reference files. Load the one that matches your task:

Task Reference
SwiftUI declarative animations (withAnimation, springs, phase, keyframe) references/swiftui-animations.md
View transitions (navigation, modal, custom Transition protocol) references/transitions.md
Gesture-driven interactive animations references/gesture-animations.md
Core Animation and UIKit animation patterns references/core-animation.md

When to Load References

  • Writing withAnimation, spring parameters, PhaseAnimator, or KeyframeAnimator → swiftui-animations.md
  • Building navigation transitions, modal presentations, matchedGeometryEffect, or custom Transition → transitions.md
  • Implementing drag-to-dismiss, swipe actions, pinch/rotate, or scroll-linked effects → gesture-animations.md
  • Working with CABasicAnimation, UIViewPropertyAnimator, layer animations, or bridging SwiftUI↔UIKit → core-animation.md

Spring Parameters Quick Reference

Springs are the default animation type in modern SwiftUI. Use duration and bounce — not mass/stiffness/damping unless bridging to UIKit/CA.

Preset Duration Bounce Use Case
.smooth 0.5 0.0 Default transitions, most state changes
.snappy 0.3 0.15 Micro-interactions, toggles, quick feedback
.bouncy 0.5 0.3 Playful moments, attention-drawing
.interactiveSpring 0.15 0.0 Gesture tracking, drag following
Custom varies varies .spring(duration: 0.4, bounce: 0.2)

Accessibility & Multimodal Feedback

Apple's HIG: "Make motion optional" and "supplement visual feedback by also using alternatives like haptics and audio to communicate." Every animation must handle Reduce Motion, and important state changes should use multiple feedback channels — not animation alone.

@Environment(\.accessibilityReduceMotion) private var reduceMotion

// Pattern 1: Conditional animation
withAnimation(reduceMotion ? .none : .spring()) {
    isExpanded.toggle()
}

// Pattern 2: Simplified alternative
.animation(reduceMotion ? .easeOut(duration: 0.15) : .spring(duration: 0.5, bounce: 0.3), value: isActive)

// Pattern 3: Skip entirely
if !reduceMotion {
    view.phaseAnimator(phases) { /* ... */ }
}

Reduce Motion fallback options (from most to least graceful):

  1. Crossfade — replace motion with opacity transition
  2. Shortened — same animation, much faster (0.1–0.15s), no bounce
  3. Instant.animation(.none) or skip the animation block entirely

Cancellation & Interruptibility

Apple's HIG: "Don't make people wait for an animation to complete before they can do anything, especially if they have to experience the animation more than once." Every animation must be interruptible.

  • Spring animations retarget automatically — this is the default and almost always what you want
  • For gesture-driven animations, the user is always in control — let them cancel mid-flight
  • For sequenced animations (KeyframeAnimator, PhaseAnimator with trigger), ensure the UI remains interactive during playback
  • Never disable user interaction during an animation unless there's a critical reason (e.g., destructive action confirmation)

Performance Checklist

  • Animate on the render server when possible — Core Animation runs off the main thread, SwiftUI's drawingGroup() moves rendering to Metal
  • Avoid animating view identity changes (.id() modifier) — this destroys and recreates the view
  • Use geometryGroup() when parent geometry changes cause child layout anomalies during animation
  • Provide explicit shadowPath when animating shadows — without it, the system recalculates the path every frame
  • In lists and scroll views, avoid per-item blur/shadow animations — these cause offscreen rendering for each cell
  • Keep PhaseAnimator and looping animations lightweight — they run continuously
  • For frequent interactions, prefer system-provided animation over custom motion — Apple's HIG: "generally avoid adding motion to UI interactions that occur frequently"
  • Profile with Instruments → "Animation Hitches" template to find frame drops

Gates (before marking work complete)

Run in order; satisfy each Pass before treating the task as done.

  1. API fit — Choose the mechanism from the API Selection table for this task. Pass: You can state in one sentence which “Need” row and API you applied (not a different layer “just because”).
  2. Reduce Motion — Custom timing must follow Accessibility & Multimodal Feedback. Pass: Non-trivial motion branches on accessibilityReduceMotion (or you only used system defaults / no custom timing).
  3. Interruptibility — Matches Cancellation & Interruptibility. Pass: No blanket allowsHitTesting(false) for the whole animation unless the task explicitly requires it and a short comment says why.
  4. Heavy or continuous motion — Loops, PhaseAnimator always-on, per-cell blur/shadow, or other Performance Checklist red flags. Pass: You ran Instruments (Animation Hitches) and captured a note or path to the trace, or you simplified the pattern first and can point to the change.
安全使用建议
This skill is a documentation/reference pack for writing iOS animations and appears coherent and low-risk. Before using generated code in a production app, review and test the snippets for correctness, thread-safety, performance, and accessibility (Reduce Motion, haptics, etc.). Although the skill requests no credentials and performs no installs, always audit any code you copy into your project (especially when bridging SwiftUI↔UIKit or using layer-level animations) and ensure examples match your target iOS versions and app architecture.
能力标签
crypto
能力评估
Purpose & Capability
Name/description (iOS animation implementation) match the provided assets: a SKILL.md and four detailed reference markdown files containing Swift/SwiftUI/UIKit/Core Animation patterns. It requests no binaries, env vars, or installs, which is proportionate for a documentation/instruction-only skill.
Instruction Scope
Runtime instructions are solely about selecting APIs and producing animation code; references and examples are internal files. There are no directives to read unrelated system files, access credentials, call external endpoints, or exfiltrate data. Example code uses typical APIs (DispatchQueue, UIViewPropertyAnimator, CABasicAnimation) in expected ways.
Install Mechanism
No install spec — the skill is instruction-only so nothing is downloaded or written to disk. This is the lowest-risk install profile and is appropriate for a documentation-style skill.
Credentials
The skill declares no environment variables, credentials, or config paths and the instructions do not reference any external secrets. The lack of requested credentials is appropriate for the stated purpose.
Persistence & Privilege
always is false and model invocation is allowed (the platform default). The skill does not request persistent system presence or modification of other skills or system-wide settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install ios-animation-implementation
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /ios-animation-implementation 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.2.1
- Documentation updated in SKILL.md for clarity, structure, and guidance. - No changes to skill logic or code; content remains up to date with best practices for iOS animation APIs. - Improved presentation and organization for easier reference and comprehension.
v1.2.0
Version 1.2.0 - Expanded skill description to cover APIs through iOS 26, including new transitions and animation patterns. - Added detailed guidance on when to use system-provided motion versus custom animation. - Included a comprehensive API selection table for picking the appropriate animation tool. - Provided categorized references and quick-loading tips for implementation patterns. - Added quick reference for SwiftUI spring parameters and common presets. - Detailed best practices for handling accessibility, Reduce Motion, and multimodal feedback. - Outlined requirements for animation cancellation, interruptibility, and performance optimization.
元数据
Slug ios-animation-implementation
版本 1.2.1
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 2
常见问题

Ios Animation Implementation 是什么?

Write Swift animation code using Apple's latest frameworks — SwiftUI animations, Core Animation, and UIKit. Prefer first-party APIs over third-party librarie... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 229 次。

如何安装 Ios Animation Implementation?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install ios-animation-implementation」即可一键安装,无需额外配置。

Ios Animation Implementation 是免费的吗?

是的,Ios Animation Implementation 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Ios Animation Implementation 支持哪些平台?

Ios Animation Implementation 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Ios Animation Implementation?

由 Kevin Anderson(@anderskev)开发并维护,当前版本 v1.2.1。

💬 留言讨论