https://editor.p5js.org/Yurriii/sketches/-F-EJuLeg
I wanted to create a centipede-like creature where multiple oscillating parts work together to create natural movement. The creature consists of a head with animated antennae and eyes, multiple body segments, and legs that drive its locomotion.
I started by breaking the code into three main components:
The most interesting challenge was making the movement feel natural. Each body segment follows the one in front with a slight delay, creating a wave-like motion. The legs move in alternating patterns, with their speed tied to the creature's velocity.
The biggest challenge was coordinating all the oscillating parts. Having too many moving pieces initially caused performance issues. I solved this by: