Walk (four legs, in place)

The walk of the game cycles for four legs: the back-left and front-right paws step together, then the back-right and front-left, the stride fitted to a speed setting so no planted paw ever slides.

Use it in a cartoonChange it in the move makerWrite it in wordsThe pack file (JSON)

What it is for

Walk (four legs, in place) is the walk of the nine game cycles, written for the fours set: four legs, numbered back-left, back-right, front-left and front-right. The gait has the legs stepping in diagonal pairs, which the program's own phase numbers confirm: the back-left and front-right paws share one half of the loop, the back-right and front-left share the other, the ordinary walking trot of a four-legged animal.

The principle it shows: arcs

The body's height still comes from the same cosine formula the two-legged walk uses, worked out from the lower leg's own bending angle rather than drawn by hand. With four legs sharing the load two at a time instead of one, that height formula only has to compare one diagonal pair against the other, which is why a four-legged walk can hold a steadier body height than a two-legged one does over the same stride.

The program, line by line

settings: speed = 0.75, h = 540, leg = 0.33, every = (clamp(0.9 - 0.3*speed, 0.45, 0.8)), stride = (57.29578*((clamp(speed*every/(4*leg), 0, 0.6)) + pow(clamp(speed*every/(4*leg), 0, 0.6), 3)/6 + 3*pow(clamp(speed*every/(4*leg), 0, 0.6), 5)/40)), give = 6, bend = 30, feet = 0.4
when it starts
  show the side view
  walk cycle every (every) s · arm swing 0 · no bob · roll 0.6 · stride (stride) · give (give) · bend (bend) · seen from the side
  back left foot follows (-feet*(stride*((1 - 4*mod(local/every + 0, 1))*(1 - step(0.5, mod(local/every + 0, 1))) + (4*mod(local/every + 0, 1) - 3)*step(0.5, mod(local/every + 0, 1))) + (give*(1 - step(0.5, mod(local/every + 0, 1))) + bend*step(0.5, mod(local/every + 0, 1)))*sin(pi*(2*mod(local/every + 0, 1) - step(0.5, mod(local/every + 0, 1))))))
  back right foot follows (-feet*(stride*((1 - 4*mod(local/every + 0.5, 1))*(1 - step(0.5, mod(local/every + 0.5, 1))) + (4*mod(local/every + 0.5, 1) - 3)*step(0.5, mod(local/every + 0.5, 1))) + (give*(1 - step(0.5, mod(local/every + 0.5, 1))) + bend*step(0.5, mod(local/every + 0.5, 1)))*sin(pi*(2*mod(local/every + 0.5, 1) - step(0.5, mod(local/every + 0.5, 1))))))
  front left foot follows (-feet*(stride*((1 - 4*mod(local/every + 0.5, 1))*(1 - step(0.5, mod(local/every + 0.5, 1))) + (4*mod(local/every + 0.5, 1) - 3)*step(0.5, mod(local/every + 0.5, 1))) + (give*(1 - step(0.5, mod(local/every + 0.5, 1))) + bend*step(0.5, mod(local/every + 0.5, 1)))*sin(pi*(2*mod(local/every + 0.5, 1) - step(0.5, mod(local/every + 0.5, 1))))))
  front right foot follows (-feet*(stride*((1 - 4*mod(local/every + 0, 1))*(1 - step(0.5, mod(local/every + 0, 1))) + (4*mod(local/every + 0, 1) - 3)*step(0.5, mod(local/every + 0, 1))) + (give*(1 - step(0.5, mod(local/every + 0, 1))) + bend*step(0.5, mod(local/every + 0, 1)))*sin(pi*(2*mod(local/every + 0, 1) - step(0.5, mod(local/every + 0, 1))))))
  dy follows (h*leg/2*(2 - (1 - step(0.5, mod(local/every, 1)))*(cos((stride*((1 - 4*mod(local/every + 0, 1))*(1 - step(0.5, mod(local/every + 0, 1))) + (4*mod(local/every + 0, 1) - 3)*step(0.5, mod(local/every + 0, 1))))*pi/180) + cos(((stride*((1 - 4*mod(local/every + 0, 1))*(1 - step(0.5, mod(local/every + 0, 1))) + (4*mod(local/every + 0, 1) - 3)*step(0.5, mod(local/every + 0, 1)))) + ((give*(1 - step(0.5, mod(local/every + 0, 1))) + bend*step(0.5, mod(local/every + 0, 1)))*sin(pi*(2*mod(local/every + 0, 1) - step(0.5, mod(local/every + 0, 1))))))*pi/180)) - step(0.5, mod(local/every, 1))*(cos((stride*((1 - 4*mod(local/every + 0.5, 1))*(1 - step(0.5, mod(local/every + 0.5, 1))) + (4*mod(local/every + 0.5, 1) - 3)*step(0.5, mod(local/every + 0.5, 1))))*pi/180) + cos(((stride*((1 - 4*mod(local/every + 0.5, 1))*(1 - step(0.5, mod(local/every + 0.5, 1))) + (4*mod(local/every + 0.5, 1) - 3)*step(0.5, mod(local/every + 0.5, 1)))) + ((give*(1 - step(0.5, mod(local/every + 0.5, 1))) + bend*step(0.5, mod(local/every + 0.5, 1)))*sin(pi*(2*mod(local/every + 0.5, 1) - step(0.5, mod(local/every + 0.5, 1))))))*pi/180))) - 0.01*h)
  sin wave on head · every (every/2) s · amp 2 · phase 0.6
  sin wave on tail · every (every) s · amp 10 · phase 1.2

Written out in full, exactly as the engine prints them:

clamp(0.9 - 0.3*speed, 0.45, 0.8)

57.29578*((clamp(speed*every/(4*leg), 0, 0.6)) + pow(clamp(speed*every/(4*leg), 0, 0.6), 3)/6 + 3*pow(clamp(speed*every/(4*leg), 0, 0.6), 5)/40)

-feet*(stride*((1 - 4*mod(local/every + 0, 1))*(1 - step(0.5, mod(local/every + 0, 1))) + (4*mod(local/every + 0, 1) - 3)*step(0.5, mod(local/every + 0, 1))) + (give*(1 - step(0.5, mod(local/every + 0, 1))) + bend*step(0.5, mod(local/every + 0, 1)))*sin(pi*(2*mod(local/every + 0, 1) - step(0.5, mod(local/every + 0, 1)))))

-feet*(stride*((1 - 4*mod(local/every + 0.5, 1))*(1 - step(0.5, mod(local/every + 0.5, 1))) + (4*mod(local/every + 0.5, 1) - 3)*step(0.5, mod(local/every + 0.5, 1))) + (give*(1 - step(0.5, mod(local/every + 0.5, 1))) + bend*step(0.5, mod(local/every + 0.5, 1)))*sin(pi*(2*mod(local/every + 0.5, 1) - step(0.5, mod(local/every + 0.5, 1)))))

h*leg/2*(2 - (1 - step(0.5, mod(local/every, 1)))*(cos((stride*((1 - 4*mod(local/every + 0, 1))*(1 - step(0.5, mod(local/every + 0, 1))) + (4*mod(local/every + 0, 1) - 3)*step(0.5, mod(local/every + 0, 1))))*pi/180) + cos(((stride*((1 - 4*mod(local/every + 0, 1))*(1 - step(0.5, mod(local/every + 0, 1))) + (4*mod(local/every + 0, 1) - 3)*step(0.5, mod(local/every + 0, 1)))) + ((give*(1 - step(0.5, mod(local/every + 0, 1))) + bend*step(0.5, mod(local/every + 0, 1)))*sin(pi*(2*mod(local/every + 0, 1) - step(0.5, mod(local/every + 0, 1))))))*pi/180)) - step(0.5, mod(local/every, 1))*(cos((stride*((1 - 4*mod(local/every + 0.5, 1))*(1 - step(0.5, mod(local/every + 0.5, 1))) + (4*mod(local/every + 0.5, 1) - 3)*step(0.5, mod(local/every + 0.5, 1))))*pi/180) + cos(((stride*((1 - 4*mod(local/every + 0.5, 1))*(1 - step(0.5, mod(local/every + 0.5, 1))) + (4*mod(local/every + 0.5, 1) - 3)*step(0.5, mod(local/every + 0.5, 1)))) + ((give*(1 - step(0.5, mod(local/every + 0.5, 1))) + bend*step(0.5, mod(local/every + 0.5, 1)))*sin(pi*(2*mod(local/every + 0.5, 1) - step(0.5, mod(local/every + 0.5, 1))))))*pi/180))) - 0.01*h

Try this

  1. Raise the walking speed from 0.75 to 1.75 body heights a second, the top of this move's fitted range. The diagonal pairs quicken and lengthen their stride together, without a planted paw sliding.

    In the program: params.speed 0.75 → 1.75

  2. Turn each stance paw only a tenth of the way flat instead of four-tenths. The walk looks lighter on its paws, each step leaving less of a trailing drag.

    In the program: params.feet 0.4 → 0.1

How it differs from Walk (in place) and Run (four legs, in place)

Walk (in place) is the two-legged version, one foot down at a time rather than a diagonal pair. Run (four legs, in place) is this same diagonal-pair mechanism pushed to a faster, wider bound.

Works on

The two in the film above, and what the move turns on each: worked out by the build, which plays the move on each body and checks what moves. Nobody types this table.
WhoMoves?What moves
Sunny (one of the six people)yeswhole body, turns, legs
Grump (an animal on four legs)yeswhole body, front legs, back legs, tail

c4c:beh:cycle_walk_fours · version 1.0.0 · c4c-free · by Jabbertoon