Projects / Web / Procedural animation
Girls Who Code Website
The website for the Girls Who Code chapter at UT Arlington, which I co-founded. Behind the page, a school of koi swims through a digital tank. None of their motion is drawn by hand: each fish is a chain of joints that code bends, steers, and draws fresh every frame.
How the fish move
Procedural animation means the motion is computed, not keyframed. Every koi on the site is built in four layers, each one driven by the layer beneath it.
A spine that follows its head
Each fish is a chain of 12 joints, a fixed distance apart. Every frame, the head moves to its target and each joint behind it is pulled along to stay one link from the joint ahead. That one rule produces the follow-through of a swimming body. To stop the fish folding in on itself, each joint can bend at most π/8 (22.5°) from its neighbour, so tight turns become smooth arcs.
A body drawn around the spine
The body isn't an image. Ten widths, widest just behind the head and tapering to the tail, set how far the outline sits from each joint. The outline is traced down one side of the spine and back up the other as a smooth curve, and the head is rounded off with three extra points. Since the outline is rebuilt from the joints every frame, the body bends wherever the spine does.
Fins and tail that react to the bend
The pectoral and ventral fins are pinned to joints 3 and 7 and rotate with the spine there. The tail and dorsal fin are sized by how curved the body is, measured as the angle difference from head to tail. A fish swimming straight keeps them slim. A fish turning hard fans its tail and lifts its dorsal fin toward the outside of the turn. The pink koi spots are anchored to joints too, so they ride along and rotate with the body.
Behaviour that picks the target
On the site, each of the 15 fish wanders: its heading drifts by a small random amount each frame, and its speed is capped so it never darts. Fish may swim 150px past the edge of the screen before turning back, because turning right at the edge looked unnatural. In feeding mode, clicking drops a pellet that sinks and fades. Any fish within 350px steers toward the nearest pellet, speeding up from 2 to 6 pixels per frame as it closes in, and eats it within 25px.
The water is procedural too. A vertical gradient sets the depth, ripple lines are two sine waves added together and drifting over time, and 200 sparkles pulse on offset sine timers.
The spine technique and the koi's proportions come from argonaut's procedural animation tutorial and its Processing source (MIT license). I adapted it to p5.js inside React and added the koi markings, a school of wandering fish, feeding, and the water effects.
Project overview
A website for Girls Who Code at the University of Texas at Arlington. The home page is the animated koi tank, with links to Who We Are, Get Involved, and the chapter calendar. I started the project in May 2025 and built out the animation in November 2025.
Why procedural animation
Procedural fish never play back a loop. No two visits look the same, and the fish respond to visitors through feeding. [To add: why you chose this approach for the chapter's site.]
Technologies used
React 19 with React Router for the pages, and p5.js (through react-p5) for the canvas animation. Built with Create React App and deployed on Vercel.
Technical implementation
The animation is split into small classes. Chain handles the spine and its bend limits. Fish draws the koi from the spine. SketchFish controls wandering and edge turns, FishFood handles the pellets, and Canvas runs the tank, feeding, and water effects. The code is commented line by line, including an explanation of each p5.js function it uses, so someone new to creative coding can follow it.
My contributions
I built the site, including the procedural animation system, the feeding interaction, the water effects, and the pages.
Challenges and lessons learned
Constraints make motion believable. Without the bend limit, the chain could fold back on itself. One clamp per joint turned it into something that swims.
Hide the seams. Fish spawn off-screen and turn beyond the edges, so visitors never see one pop into view or bounce off a wall.
Test on phones early. A full-screen canvas behaves differently on mobile, and the site needed a dedicated fix to work there.