Turn any SVG into a professional 60 fps animation. A Claude Code skill that brings anything drawn to life: live faces, full-body acting and whole scenes, in React Native and SwiftUI.
Swift
README in the shape of emilkowalski/skills, with the reveal on top
Eder Rosad34b331d3848
diff --git a/README.md b/README.mdindex 0099a9e..a36dc50 100644--- a/README.md+++ b/README.md@@ -1,99 +1,80 @@-# rossark-motion-skill+<a href="demo/reveal.mp4">+<img width="360" alt="A blue silhouette floats in with dangling feet, then a kid in a striped kit drops in, lands, kicks a ball that rolls in from the right, waves, grins and hops" src="demo/reveal.gif" />+</a>-+# Motion For Anything You Draw-<sub>Rendered from `demo/DemoScene.swift` with the SwiftUI templates in this repo: one clock, an 8-second loop. [MP4 version](demo/demo.mp4).</sub>+[](https://skills.sh/rossark0/rossark-motion-skill)-A Claude Code skill for bringing anything drawn to life: characters and creatures, plants, cloth, fire, smoke, water, weather, lights, machines, vehicles, icons, logos, charts and whole scenes. The motion is calm and believable, and it never teleports. Characters can act: land, gesture, shift their weight, turn their head, float and play with props, without ever freezing between poses.+For designers and engineers who want what they draw to feel alive.-It comes with:-- a small motion engine and templates for React Native (`react-native-svg` + `react-native-reanimated`) and SwiftUI (`TimelineView` + `Canvas`, iOS 17+ / macOS 14+);-- tools that measure a reference video frame by frame;-- an offline renderer that turns scenes into MP4 and GIF, in a phone frame too.+Making a drawing move is easy. Making it feel alive is hard: it has to breathe, look around, blink, shift its weight and act, without ever freezing or jumping. This skill helps your agent get there.-The method works the same on the web.+It started as the method I used to bring the illustrations in my app to life, and grew into a way to animate anything drawn: characters and creatures, plants, cloth, fire, smoke, water, weather, lights, machines, icons, logos, charts and whole scenes.-## What's inside--| File | What it is |-|---|---|-| `SKILL.md` | The skill: principles, the engine, recipes for every kind of subject, faces, full-body acting, scenes that tell an action, pitfalls, platforms, working from a reference video, and a workflow. |-| `MOTION.md` | A notes file to copy into your project. Part 1 is the method in short form; Part 2 is where your project's specifics go (where the code is, the owner's rules, rig limits, how changes are checked). The skill reads it first. |-| `templates/react-native/motion.ts` | The engine: loop and one-shot clocks, keyframe `track`, `flow` (smooth acting through key poses), `seg`, `wave`, `loop`, `bell`, `seeded` and the curves. |-| `templates/react-native/liveFace.tsx` | A live face on top of the engine: `LiveEye`, `LiveMouth`, `Choreo`. You give it the eye geometry and colours. |-| `templates/swiftui/Motion.swift` | The same engine in SwiftUI: `LoopClock`, `OneShotClock`, `track`, `flow`, `seg`, `wave`, `loop`, `bell`, `seeded`, and the `travel` and `open` animations. |-| `templates/swiftui/LiveFace.swift` | The same live face, drawn into a `Canvas`: `drawLiveEye`, `drawLiveMouth`, `Choreo`. |-| `tools/sheet.sh` | Contact sheets of a video at its full frame rate, to study timing (or to check your own render). |-| `tools/track_edges.py` | Measures a subject's edges frame by frame, so you can see motion too small for the eye (a 2% jiggle, a float, a sway). |-| `tools/sample_colors.py` | Reads exact colours from a video frame. |-| `demo/` | Three scenes, a phone frame (`PhoneMockup.swift`) and the renderer (`render.swift`). |+The animation above is drawn and animated entirely in code, with the templates in this repo.## Install-For all your projects:-```bash-git clone https://github.com/rossark0/rossark-motion-skill ~/.claude/skills/rossark-motion-skill+npx skills@latest add rossark0/rossark-motion-skill```-For one project only, clone it into that project's `.claude/skills/rossark-motion-skill` instead.+## Why use it?-Then, in Claude Code, ask it to animate something ("make this plant sway", "bring the mascot to life", "make it move like this video"), or type `/rossark-motion-skill`.+Agents don't animate like animators.-## First time in a project+Ask an agent to bring a character to life and it will often swap one drawing for another, so the face teleports from one expression to the next. It moves through each pose with its own eased tween, so the body stops dead at every pose. Everything moves in sync, like a machine. Blinks are so short they flicker, everything bounces, and a thin line shows across the face where two shapes meet.-1. Copy `MOTION.md` next to your art (for example `src/art/MOTION.md`).-2. Fill in Part 2 as you go: the files, your rules (in your own words), what your art can't do, and how you test.-3. Copy the engine for your platform (`templates/react-native/` or `templates/swiftui/`) if the project doesn't have one yet.+All these small things add up, and the result looks like a slideshow instead of something alive.-## The idea in one paragraph+This skill lists those mistakes and how to fix them: one clock for the whole scene, parts that turn around their real pivots, trailing parts that follow a beat later, idle life that never stops, smooth paths through key poses, small amplitudes and strong curves. When you have a reference video, it measures the motion frame by frame before building, because what makes a reference feel alive is often too small to see.-Every moving thing reads a clock. A loop clock gives idle life; a one-shot clock tells a small story when a scene appears. Parts are layers that rotate around their real pivots, trailing parts lag behind, and repeated things never move in sync. Characters get live eyes, and when they act, every channel is a smooth path through key poses, plus idle life that never stops, plus follow-through. Amplitudes stay small and the curves are strong. Everything stops on a good frame when the user asks for reduced motion, and nothing runs off screen.+For motion in an interface, it follows [Emil Kowalski's](https://github.com/emilkowalski/skills) rules and Benji Taylor's [Family values](https://benji.org/family-values).-## The demos+## Reference-All three are drawn with `templates/swiftui/`, each on one clock, in seamless loops.+- **[SKILL.md](./SKILL.md)**: The skill. Principles, recipes for every kind of subject, live faces, full-body acting, scenes that tell an action, motion in an interface, pitfalls, working from a reference video, and a workflow.+- **[MOTION.md](./MOTION.md)**: A notes file for your project. Copy it next to your art and fill in Part 2 as you go: where the code is, your rules, what your art can't do, and how you check changes. The skill reads it first.+- **[motion.ts](./templates/react-native/motion.ts)** and **[Motion.swift](./templates/swiftui/Motion.swift)**: The engine, for React Native and SwiftUI. Loop and one-shot clocks, `track`, `flow` (smooth acting through key poses), `seg`, `wave`, `loop`, `bell`, `seeded` and the curves.+- **[liveFace.tsx](./templates/react-native/liveFace.tsx)** and **[LiveFace.swift](./templates/swiftui/LiveFace.swift)**: Live eyes and mouths that glide, blink and smile. You give them the geometry and the colours.+- **[sheet.sh](./tools/sheet.sh)**: Contact sheets of a video at its full frame rate, to study timing or check your own render.+- **[track_edges.py](./tools/track_edges.py)**: Measures a subject's edges frame by frame, to catch motion too small for the eye: a 2% jiggle, a float, a sway.+- **[sample_colors.py](./tools/sample_colors.py)**: Reads exact colours from a video frame.+- **[demo/](./demo)**: The scenes on this page, a phone frame and an offline renderer that turns them into MP4 and GIF.-**Room** (`demo/DemoScene.swift`, at the top of this page):-- a creature that breathes, with ears that follow through and live eyes that look, blink and smile;-- snow in the window, with seeded variety;-- steam that rises and fades;-- a candle flickering on two waves;-- a plant swaying around its base, with leaves that lag behind.+## Demos++**Reveal** ([source](demo/RevealScene.swift), [MP4](demo/reveal.mp4)), at the top of this page. Full-body acting in a phone frame, on one clock, in a 9-second loop at 60 fps:+- a mystery silhouette floats in, its feet hanging limp, its shadow breathing with the height;+- the kid hovers, falls with gravity, squashes on landing and keeps the volume;+- poses flow into each other with `flow`, idle life never stops, and the head and forearms follow through;+- a ball rolls in from off screen, the eyes follow it, the kick hits at the middle of the swing, and the ball flies off spinning; then the kid turns to you and waves;+- a toy-like build seen from a little above: a big head, a short torso, round shoes and a wide oval shadow.-**Orbit** (`demo/OrbitScene.swift`):+**Orbit** ([source](demo/OrbitScene.swift), [MP4](demo/orbit.mp4)):-+<img width="360" alt="A round bird with closed eyes floats while a tilted ring of cards orbits around it, with sparkles twinkling" src="demo/orbit.gif" />- a ring of cards orbiting in depth: the fronts in front of the bird, the backs behind it, edge-on at the sides;- the bird floats and tilts, its wings flutter, and its feet and tufts follow through;- sparkles that appear and disappear once per loop, at seeded times.-[MP4 version](demo/orbit.mp4).--**Reveal** (`demo/RevealScene.swift`), full-body acting in a phone frame:+**Room** ([source](demo/DemoScene.swift), [MP4](demo/demo.mp4)):-+<img width="360" alt="A creature with live eyes, snow in the window, steam, a candle and a swaying plant, all on one clock" src="demo/demo.gif" />-- a mystery silhouette floats in, its feet hanging limp, its shadow breathing with the height;-- the kid hovers, falls with gravity, squashes on landing and keeps the volume;-- poses flow into each other with `flow`; idle life never stops; the head and forearms follow through;-- elbows bend, the head turns by sliding the face (2.5D), and the weight shifts from leg to leg;-- a ball rolls in from off screen, the eyes follow it, the kick hits at the middle of the swing, and the ball flies off spinning;-- a toy-like build seen from a little above: a big head, a short torso, round shoes and a wide oval shadow.--[MP4 version](demo/reveal.mp4), square and ready to post.+- a creature that breathes, with ears that follow through and live eyes that look, blink and smile;+- snow in the window, with seeded variety;+- steam that rises and fades;+- a candle flickering on two waves;+- a plant swaying around its base, with leaves that lag behind.To render them again on macOS 14+:```bashswiftc -parse-as-library -target arm64-apple-macos14 \templates/swiftui/Motion.swift templates/swiftui/LiveFace.swift demo/*.swift -o /tmp/render-demo-/tmp/render-demo room /tmp/frames # or: orbit, reveal-/tmp/render-demo reveal /tmp/frames phone fps=60 # inside a phone frame, on a square page, at 60 fps+/tmp/render-demo reveal /tmp/frames phone fps=60 # or: orbit, roomffmpeg -framerate 60 -i /tmp/frames/%04d.png -c:v libx264 -pix_fmt yuv420p -crf 20 demo/reveal.mp4```--## License--MIT. See `LICENSE`.diff --git a/demo/render.swift b/demo/render.swiftindex 9652de1..327e943 100644--- a/demo/render.swift+++ b/demo/render.swift@@ -2,11 +2,11 @@//// swiftc -parse-as-library -target arm64-apple-macos14 \// templates/swiftui/Motion.swift templates/swiftui/LiveFace.swift demo/*.swift -o /tmp/render-demo-// /tmp/render-demo room /tmp/frames # or: orbit, reveal+// /tmp/render-demo reveal /tmp/frames # or: orbit, room// /tmp/render-demo reveal /tmp/frames phone # inside an iPhone, on a square page// /tmp/render-demo reveal /tmp/frames phone fps=60 # smoother, for posting// /tmp/render-demo reveal /tmp/frames phone 0 40 # only these frames (to check before a full render)-// ffmpeg -framerate 30 -i /tmp/frames/%04d.png -c:v libx264 -pix_fmt yuv420p -crf 20 demo/demo.mp4+// ffmpeg -framerate 30 -i /tmp/frames/%04d.png -c:v libx264 -pix_fmt yuv420p -crf 20 demo/reveal.mp4import Foundationimport ImageIOimport SwiftUI@@ -17,7 +17,9 @@ func scene(_ name: String, _ t: Double, phone: Bool) -> (view: AnyView, loopMs:switch name {case "orbit":return (AnyView(OrbitScene(t: t)), OrbitScene.loopMs)- case "reveal":+ case "room":+ return (AnyView(DemoScene(t: t)), DemoScene.loopMs)+ default:guard phone else { return (AnyView(RevealScene(t: t)), RevealScene.loopMs) }// The 720-wide scene, as big as the screen allows, with the feet at 73% of the screen.let screen = PhoneMockup<EmptyView>.screen@@ -27,8 +29,6 @@ func scene(_ name: String, _ t: Double, phone: Bool) -> (view: AnyView, loopMs:.scaleEffect(k, anchor: .topLeading).offset(x: -(720 * k - screen.width) / 2)}), RevealScene.loopMs)- default:- return (AnyView(DemoScene(t: t)), DemoScene.loopMs)}}@@ -37,7 +37,7 @@ struct RenderDemo {@MainActorstatic func main() throws {var args = Array(CommandLine.arguments.dropFirst())- let name = args.isEmpty ? "room" : args.removeFirst()+ let name = args.isEmpty ? "reveal" : args.removeFirst()let out = URL(fileURLWithPath: args.isEmpty ? "frames" : args.removeFirst())let phone = args.first == "phone"if phone { args.removeFirst() }