The Seed — animate your first story scene
This is Part 2 of the SuccessGraph cartoon-world course. The ten-second scene continues the island and rabbits from Part 1. A seed tumbles across the grass, one rabbit notices it and hops closer, and the second rabbit turns to share a look.
Start here
Use Node.js 22.12 or newer and a desktop browser with WebGL 2. Extract the project ZIP. Open a terminal in the folder containing package.json, then run:
npm ci
npm run lesson
Open the Local URL printed by Vite. Keep the terminal running. The scene plays once and holds its last pose. Replay restarts it. Drag the slider to inspect a pose, including backwards. The checkpoint menu isolates each learning step.
1. Reuse the world
Open world.js, the finished Part 1 scene. shot.js imports its makeWorld function. The scene, camera, renderer, and rabbits are reused. Its original looping render function is replaced by shot.seek for this story.
Open main.js to find the browser loop and index.html for playback controls.
2. Block the action
A parent group is created for each rabbit. The parent starts at the rabbit's original world position. The rabbit becomes its child and receives a local position of zero. The smaller rabbit keeps its original scale.
This hierarchy gives each action a clear owner:
- HeroRoot and FriendRoot own the story positions and turns.
- HeroPose and FriendPose own squash, lean, and small idle motion.
- SeedRoot owns travel across the grass.
- SeedBody owns the tumble.
Select Blocking and scrub. The positions stay at their starting values while the child idle continues. The seed is placed in front of the characters so its path remains readable.
3. Animate the seed
Find seedTracks in shot.js. The VectorKeyframeTrack targets SeedRoot.position. Each time has three matching values, in X, Y, Z order. Eight times therefore require twenty-four position values.
The NumberKeyframeTrack targets SeedBody.rotation[z]. Its values are radians. The increasingly small changes near the end make the tumble settle. Rotation belongs to the seed mesh, so it spins around itself while its parent follows the path.
Select Seed and scrub from zero to six seconds. Change the final X value from 1.05 to .8 in both final position entries, save, and check the landing. Restore it before continuing.
4. Make the rabbit notice
Find noticeTracks. The first track turns HeroRoot.rotation[y] after 1.6 seconds. That delay lets the seed arrive before the rabbit responds.
The second track targets HeroPose.scale. The crouch makes Y smaller and X/Z wider before takeoff. The landing briefly repeats the compression, then returns to the resting scale.
Select Notice and compare times 3.2, 3.65, and 4.25. The scale track animates a child, so its compression cannot replace the parent position.
5. Add the hop
Find hopTracks. The parent moves horizontally while its Y values trace an arc. It leaves the ground at four seconds and reaches the ground at 5.1 seconds. At 4.55 seconds its height is 1.05.
Select Hop and scrub slowly through the movement. Try changing the apex Y value from 1.05 to 1.3. Keep takeoff and landing at .2. Reset the apex after comparison.
These tracks use linear interpolation between authored poses. Add more intermediate poses to refine an arc. The seed and hop are directed animation, so no physics engine is required.
6. Delay the second reaction
Find friendTracks. The second rabbit waits until 6.5 seconds. FriendRoot.rotation[x] then tips its face down toward the seed, reaching .18 radians at 6.9 seconds. Hold that pose to 7.15 seconds. FriendRoot.rotation[y] begins its turn at 7.15 seconds and reaches -.65 radians at 8.2 seconds, as the face rises to its resting pitch. A slight child lean supports the reaction. Select Full Shot for the completed shot.
Watch the final two seconds without touching the controls. The pause lets the viewer read the shared look. Scrub between 6.4 and 6.9 seconds to compare the resting pose with the downward look. Then compare 7.15 and 8.2 seconds to see the turn toward the first rabbit. Try moving the yaw track's 7.15 key to 6.5 seconds and its 8.2 key to 7.55 seconds, then compare how the shorter delay changes the mood.
7. Seek deterministically
Each group of tracks has its own AnimationClip, AnimationAction, and AnimationMixer. Actions use LoopOnce and clampWhenFinished so the final pose holds.
seek clamps absolute time to the ten-second shot, resets and starts the actions, then calls mixer.setTime. Calling seek(5) after seek(9) produces the same pose as calling seek(5) after seek(0). This makes replay, scrubbing, and fixed-frame video capture agree.
The checkpoint chooses how many track groups receive the requested time. The remaining groups receive zero. The same completed source therefore supports every checkpoint.
8. Keep time in seconds
main.js receives a timestamp in milliseconds from requestAnimationFrame. It records the first timestamp as playbackStart. Subtract that start from the current timestamp and divide by 1000 to get elapsed seconds. Add resumeTime, the slider position from which playback began, to support pause and resume.
The replay button sets time and resumeTime to zero and clears playbackStart. Resuming after a pause or scrub records the current scene time as resumeTime, then starts a fresh elapsed-time interval. Scrubbing pauses playback. The resize handler updates the existing renderer and camera. Stop the development server with Ctrl+C.
Troubleshooting
If the page is blank, check the browser console and terminal for the first error. Use the Vite URL rather than opening index.html directly. Verify WebGL 2 support.
If a rabbit snaps to the wrong location, check that its parent received its old world position before its local position was cleared. Avoid writing an animated property from two places. The mixer owns story translation while idle owns the child offset.
If a track fails to move an object, check its name against the track target exactly. Vector tracks need three values for every time. Keep times ascending and include a final resting key.