# iOS Animation Graphics Skill

> Creating animations and graphics using SwiftUI Canvas, Core Animation, and Lottie integration for engaging iOS app experiences.

- **Type:** Skill
- **Install:** `agentstack add skill-fal3-claude-skills-collection-ios-animation-graphics-skill`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [fal3](https://agentstack.voostack.com/s/fal3)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [fal3](https://github.com/fal3)
- **Source:** https://github.com/fal3/claude-skills-collection/tree/main/skills/ios-animation-graphics-skill

## Install

```sh
agentstack add skill-fal3-claude-skills-collection-ios-animation-graphics-skill
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# iOS Animation Graphics Skill

This skill provides expertise in creating smooth animations and custom graphics for iOS applications using SwiftUI Canvas, Core Animation, and Lottie. It covers animation principles, performance considerations, and integration with Apple's design system.

## Best Practices

1. **Performance First**: Use lightweight animations that don't impact scrolling or user interaction.

2. **Meaningful Motion**: Ensure animations enhance user experience and provide visual feedback.

3. **Consistent Timing**: Use standard animation durations (0.2-0.5 seconds) for familiarity.

4. **Hardware Acceleration**: Leverage GPU-accelerated properties for smooth animations.

5. **Accessibility**: Respect reduced motion preferences and provide alternatives.

6. **State-Driven**: Bind animations to view state for automatic updates.

## Animation Guidelines

- Use SwiftUI's built-in animation modifiers for simple transitions.
- Implement Canvas for custom drawings and complex graphics.
- Integrate Lottie for designer-created animations.
- Combine multiple animation techniques for rich interactions.
- Test animations on actual devices for performance.
- Consider different screen sizes and orientations.

## Examples

### Example 1: Basic SwiftUI Animations

**User Prompt:** "Create a button that scales and changes color when tapped using SwiftUI animations."

**Expected Output:**
```swift
import SwiftUI

struct AnimatedButton: View {
    @State private var isPressed = false
    @State private var tapCount = 0
    
    var body: some View {
        ZStack {
            Circle()
                .fill(isPressed ? Color.blue : Color.red)
                .frame(width: isPressed ? 120 : 100, height: isPressed ? 120 : 100)
                .shadow(radius: isPressed ? 10 : 5)
                .animation(.spring(response: 0.3, dampingFraction: 0.6), value: isPressed)
            
            Text("\(tapCount)")
                .font(.title)
                .foregroundColor(.white)
                .scaleEffect(isPressed ? 1.2 : 1.0)
                .animation(.easeInOut(duration: 0.2), value: isPressed)
        }
        .onTapGesture {
            isPressed.toggle()
            tapCount += 1
            
            // Reset after animation
            DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
                isPressed = false
            }
        }
    }
}

// Advanced example with multiple animations
struct ComplexAnimatedView: View {
    @State private var isAnimating = false
    
    var body: some View {
        VStack(spacing: 20) {
            RoundedRectangle(cornerRadius: 20)
                .fill(Color.blue)
                .frame(width: isAnimating ? 200 : 100, height: 100)
                .rotationEffect(.degrees(isAnimating ? 360 : 0))
                .offset(y: isAnimating ? -50 : 0)
                .animation(.interpolatingSpring(mass: 1.0, stiffness: 100, damping: 10, initialVelocity: 0), value: isAnimating)
            
            Button("Animate") {
                isAnimating.toggle()
            }
            .buttonStyle(.borderedProminent)
        }
        .padding()
    }
}
```

### Example 2: SwiftUI Canvas for Custom Graphics

**User Prompt:** "Draw a custom animated waveform using SwiftUI Canvas."

**Expected Output:**
```swift
import SwiftUI

struct WaveformView: View {
    @State private var phase = 0.0
    
    var body: some View {
        VStack {
            Canvas { context, size in
                let width = size.width
                let height = size.height
                let centerY = height / 2
                
                // Draw waveform
                var path = Path()
                path.move(to: CGPoint(x: 0, y: centerY))
                
                for x in stride(from: 0, to: width, by: 1) {
                    let relativeX = x / width
                    let y = centerY + sin(relativeX * .pi * 4 + phase) * 30
                    path.addLine(to: CGPoint(x: x, y: y))
                }
                
                context.stroke(path, with: .color(.blue), lineWidth: 2)
                
                // Draw amplitude bars
                for i in 0.. UIView {
        let view = UIView()
        view.addSubview(animationView)
        animationView.translatesAutoresizingMaskIntoConstraints = false
        NSLayoutConstraint.activate([
            animationView.topAnchor.constraint(equalTo: view.topAnchor),
            animationView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
            animationView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
            animationView.trailingAnchor.constraint(equalTo: view.trailingAnchor)
        ])
        return view
    }
    
    func updateUIView(_ uiView: UIView, context: Context) {
        // Update if needed
    }
}

// Alternative: Using Lottie with SwiftUI state
struct StatefulLottieView: View {
    @State private var play = false
    
    var body: some View {
        VStack {
            LottieView(animation: .named("loading"))
                .playbackMode(.playing(.toProgress(1, loopMode: .loop)))
                .frame(height: 100)
            
            Button("Toggle Animation") {
                play.toggle()
            }
            .buttonStyle(.bordered)
        }
    }
}
```

### Example 4: Core Animation with UIViewRepresentable

**User Prompt:** "Create a UIViewRepresentable that uses Core Animation for a rotating gradient border."

**Expected Output:**
```swift
import SwiftUI
import UIKit

struct RotatingGradientBorder: View {
    @State private var isAnimating = false
    
    var body: some View {
        ZStack {
            GradientBorderView(isAnimating: $isAnimating)
                .frame(width: 150, height: 150)
            
            Button(action: {
                isAnimating.toggle()
            }) {
                Text(isAnimating ? "Stop" : "Start")
                    .foregroundColor(.white)
                    .padding()
                    .background(Color.blue.opacity(0.8))
                    .cornerRadius(10)
            }
        }
    }
}

struct GradientBorderView: UIViewRepresentable {
    @Binding var isAnimating: Bool
    
    func makeUIView(context: Context) -> UIView {
        let view = UIView()
        view.backgroundColor = .clear
        
        // Create gradient layer
        let gradientLayer = CAGradientLayer()
        gradientLayer.colors = [UIColor.red.cgColor, UIColor.blue.cgColor, UIColor.green.cgColor, UIColor.red.cgColor]
        gradientLayer.startPoint = CGPoint(x: 0, y: 0)
        gradientLayer.endPoint = CGPoint(x: 1, y: 1)
        gradientLayer.frame = view.bounds
        
        // Create shape layer for border
        let shapeLayer = CAShapeLayer()
        shapeLayer.lineWidth = 4
        shapeLayer.fillColor = UIColor.clear.cgColor
        shapeLayer.strokeColor = UIColor.black.cgColor
        shapeLayer.path = UIBezierPath(roundedRect: view.bounds.insetBy(dx: 2, dy: 2), cornerRadius: 20).cgPath
        
        // Mask gradient with shape
        gradientLayer.mask = shapeLayer
        
        // Add rotation animation
        let rotationAnimation = CABasicAnimation(keyPath: "transform.rotation.z")
        rotationAnimation.fromValue = 0
        rotationAnimation.toValue = CGFloat.pi * 2
        rotationAnimation.duration = 2.0
        rotationAnimation.repeatCount = .infinity
        
        context.coordinator.animation = rotationAnimation
        context.coordinator.gradientLayer = gradientLayer
        
        view.layer.addSublayer(gradientLayer)
        
        return view
    }
    
    func updateUIView(_ uiView: UIView, context: Context) {
        if isAnimating {
            context.coordinator.gradientLayer?.add(context.coordinator.animation!, forKey: "rotation")
        } else {
            context.coordinator.gradientLayer?.removeAnimation(forKey: "rotation")
        }
    }
    
    func makeCoordinator() -> Coordinator {
        Coordinator()
    }
    
    class Coordinator {
        var animation: CABasicAnimation?
        var gradientLayer: CAGradientLayer?
    }
}

// Advanced Core Animation example
struct ParticleSystemView: UIViewRepresentable {
    func makeUIView(context: Context) -> UIView {
        let view = UIView()
        
        // Create particle emitter
        let emitter = CAEmitterLayer()
        emitter.emitterPosition = CGPoint(x: 200, y: 100)
        emitter.emitterSize = CGSize(width: 10, height: 10)
        emitter.emitterShape = .circle
        
        // Create particle cell
        let cell = CAEmitterCell()
        cell.birthRate = 50
        cell.lifetime = 2.0
        cell.velocity = 100
        cell.velocityRange = 50
        cell.emissionRange = .pi * 2
        cell.scale = 0.1
        cell.scaleRange = 0.05
        cell.contents = UIImage(systemName: "star.fill")?.cgImage
        cell.color = UIColor.blue.cgColor
        
        emitter.emitterCells = [cell]
        view.layer.addSublayer(emitter)
        
        return view
    }
    
    func updateUIView(_ uiView: UIView, context: Context) {
        // Update if needed
    }
}
```

### Example 5: Matched Geometry Effect

**User Prompt:** "Implement a hero transition between two views using SwiftUI's matchedGeometryEffect."

**Expected Output:**
```swift
import SwiftUI

struct HeroTransitionView: View {
    @State private var selectedItem: Item?
    @Namespace private var namespace
    
    let items = [
        Item(id: 1, title: "Mountain", imageName: "mountain", description: "A beautiful mountain landscape"),
        Item(id: 2, title: "Ocean", imageName: "ocean", description: "Peaceful ocean waves"),
        Item(id: 3, title: "Forest", imageName: "forest", description: "Lush green forest")
    ]
    
    var body: some View {
        ZStack {
            if let selectedItem = selectedItem {
                DetailView(item: selectedItem, namespace: namespace)
                    .onTapGesture {
                        withAnimation(.spring()) {
                            self.selectedItem = nil
                        }
                    }
            } else {
                GridView(items: items, selectedItem: $selectedItem, namespace: namespace)
            }
        }
    }
}

struct GridView: View {
    let items: [Item]
    @Binding var selectedItem: Item?
    let namespace: Namespace.ID
    
    var body: some View {
        ScrollView {
            LazyVGrid(columns: [GridItem(.adaptive(minimum: 150))], spacing: 16) {
                ForEach(items) { item in
                    GridItemView(item: item, namespace: namespace)
                        .onTapGesture {
                            withAnimation(.spring()) {
                                selectedItem = item
                            }
                        }
                }
            }
            .padding()
        }
    }
}

struct GridItemView: View {
    let item: Item
    let namespace: Namespace.ID
    
    var body: some View {
        VStack {
            Image(item.imageName)
                .resizable()
                .aspectRatio(contentMode: .fill)
                .frame(height: 100)
                .clipped()
                .cornerRadius(8)
                .matchedGeometryEffect(id: item.id, in: namespace)
            
            Text(item.title)
                .font(.caption)
                .foregroundColor(.primary)
        }
        .background(Color.white)
        .cornerRadius(8)
        .shadow(radius: 2)
    }
}

struct DetailView: View {
    let item: Item
    let namespace: Namespace.ID
    
    var body: some View {
        VStack {
            Spacer()
            
            Image(item.imageName)
                .resizable()
                .aspectRatio(contentMode: .fit)
                .frame(maxHeight: 300)
                .clipped()
                .cornerRadius(16)
                .matchedGeometryEffect(id: item.id, in: namespace)
                .padding()
            
            Text(item.title)
                .font(.largeTitle)
                .foregroundColor(.primary)
            
            Text(item.description)
                .font(.body)
                .foregroundColor(.secondary)
                .multilineTextAlignment(.center)
                .padding()
            
            Spacer()
        }
        .background(Color.white)
        .edgesIgnoringSafeArea(.all)
    }
}

struct Item: Identifiable {
    let id: Int
    let title: String
    let imageName: String
    let description: String
}
```

Note: For the image examples above, you would need to add actual images to your asset catalog or use system images.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [fal3](https://github.com/fal3)
- **Source:** [fal3/claude-skills-collection](https://github.com/fal3/claude-skills-collection)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-fal3-claude-skills-collection-ios-animation-graphics-skill
- Seller: https://agentstack.voostack.com/s/fal3
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
