agentleFS
moasqmoasq/ios-dev-agent/.agents/skills/animations/SKILL.md

animations

Skill4 starsChanged 6 months agoMITView on GitHub

Use when implementing or debugging animations. Covers containment, modifier order, GPU transforms, timing curves, transitions, phase/keyframe.

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

9 rules. 0 are common, 2 are distinctive, and 7 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this guide when implementing or debugging animations.

    line 8
  2. Very specific:

    Do NOT use .drawingGroup() — rasterizes via Metal, wastes memory

    line 24
  3. Very specific:

    Do NOT rely on .scaleEffect(1) hack — fragile and undocumented

    line 25
  4. Very specific:

    Use .scaleEffect, .offset, .rotationEffect, .opacity — GPU-accelerated, no layout pass.

    line 52
  5. Very specific:

    Avoid animating .frame, .padding, .font — triggers full layout recalculation.

    line 53
  6. Distinctive:

    Keep durations under 0.5s for responsive feel.

    line 63
  7. Very specific:

    Use withAnimation for user-triggered changes

    line 74
  8. Very specific:

    Use .animation(_:value:) for derived/computed changes

    line 75
  9. Very specific:

    Place withAnimation or .animation OUTSIDE the conditional:

    line 78

“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Animation Safety

Use this guide when implementing or debugging animations.

Containment (CRITICAL)

Animated content inside a container MUST NOT overflow its parent. Apply on the PARENT:

CardContainer {
    AnimatedContent()
        .transition(.scale.combined(with: .opacity))
}
.compositingGroup()
.clipped()
  • .compositingGroup() flattens child layers into one pass
  • .clipped() clips to parent frame
  • Together they guarantee zero visual overflow during any animation phase
  • Do NOT use .drawingGroup() — rasterizes via Metal, wastes memory
  • Do NOT rely on .scaleEffect(1) hack — fragile and undocumented

When to Apply

  • Any view with .transition() inside a sized container
  • Spring/bouncy animations that may overshoot bounds
  • Phase/keyframe animations that scale or offset children
  • ScrollView items with animated insertion/removal

When NOT Needed

  • Full-screen views with no parent boundary
  • Opacity-only animations
  • System navigation transitions

Modifier Order

// CORRECT — animation AFTER layout, containment on parent
VStack {
    content
        .offset(y: animating ? -20 : 0)
        .opacity(animating ? 0 : 1)
        .animation(.spring(duration: 0.4), value: animating)
}
.compositingGroup()
.clipped()

Prefer GPU Transforms

Use .scaleEffect, .offset, .rotationEffect, .opacity — GPU-accelerated, no layout pass. Avoid animating .frame, .padding, .font — triggers full layout recalculation.

Timing Curves

CurveUse Case
.spring(duration: 0.3)Default for most UI
.spring(duration: 0.4, bounce: 0.3)Playful emphasis
.easeInOut(duration: 0.25)Subtle transitions
.bouncyIntentional delight only

Keep durations under 0.5s for responsive feel.

Animation Scope

// CORRECT — scoped to specific value
.animation(.easeInOut(duration: 0.2), value: isSelected)

// WRONG — unscoped, animates everything
.animation(.easeInOut)
  • Bind .animation to a specific value — NEVER use without value parameter
  • Use withAnimation for user-triggered changes
  • Use .animation(_:value:) for derived/computed changes

Transitions

Place withAnimation or .animation OUTSIDE the conditional:

withAnimation(.spring(duration: 0.3)) {
    showDetail.toggle()
}
if showDetail {
    DetailView()
        .transition(.opacity.combined(with: .move(edge: .bottom)))
}

Phase and Keyframe (iOS 17+)

PhaseAnimator([false, true]) { phase in
    Icon()
        .scaleEffect(phase ? 1.1 : 1.0)
        .opacity(phase ? 1.0 : 0.7)
}
.compositingGroup()
.clipped()

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.