Run (four legs, in place)

The run of the game cycles for four legs: a bounding trot, the diagonal pairs reaching far, the body rocking and the tail streaming, fitted to a speed setting so no planted paw ever slides.

A cartoon person and a dog bounding in place, legs reaching far, tail streaming.

Use it in a cartoonOpen it in the block editorThe pack file (JSON)

What it is for

Run (four legs, in place) is the run of the nine game cycles, written for the fours set: a bounding trot, the legs in diagonal pairs reaching far, the body rocking and the tail streaming out behind, the same diagonal pairing Walk (four legs, in place) uses, pushed to a sprint.

The principle it shows: exaggeration

Most of the walk's numbers are simply pushed further: a wider stride, a knee give of 12 degrees instead of 6 and a bend of 60 instead of 30. One number drops instead of growing: the walk's small 0.6-degree body roll disappears entirely here, as if the body holds itself steadier to put everything into the reach of the stride rather than a side-to-side rock.

The program, line by line

settings: speed = 1.5, h = 540, leg = 0.33, every = (clamp(0.52 - 0.08*speed, 0.3, 0.46)), stride = (57.29578*((clamp(speed*every/(4*leg), 0, 0.7)) + pow(clamp(speed*every/(4*leg), 0, 0.7), 3)/6 + 3*pow(clamp(speed*every/(4*leg), 0, 0.7), 5)/40)), give = 12, bend = 60, feet = 0.4
when it starts
  show the side view
  set head -6, tail 20
  walk cycle every (every) s · arm swing 0 · no bob · roll 0 · 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.03*h*pow(cos(2*pi*mod(local/every, 1)), 2))
  sin wave on torso · every (every/2) s · amp 3
  sin wave on tail · every (every/2) s · amp 12 · phase 1.2

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

clamp(0.52 - 0.08*speed, 0.3, 0.46)

57.29578*((clamp(speed*every/(4*leg), 0, 0.7)) + pow(clamp(speed*every/(4*leg), 0, 0.7), 3)/6 + 3*pow(clamp(speed*every/(4*leg), 0, 0.7), 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.03*h*pow(cos(2*pi*mod(local/every, 1)), 2)

Try this

  1. Raise the running speed from 1.5 to 3 body heights a second, the top of this move's fitted range. The bound widens and quickens together, without a planted paw sliding.

    In the program: params.speed 1.5 → 3

  2. Turn each stance paw only a little way flat instead of four-tenths. The run stays up on its toes through each landing instead of planting flush.

    In the program: params.feet 0.4 → 0.15

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

Walk (four legs, in place) is the same diagonal-pair mechanism at a gentler trot, with a small body roll this run drops entirely. Run (in place) is the two-legged version of a sprint, one foot changing over at a time rather than a diagonal pair.

Works on

Worked out by the build: it plays the move in the engine on each body and checks what moves on screen. Nobody types this table.
BodyMoves?What moves
2 legs (a person)yeswhole body, turns, body, head, arms, legs
4 legs (a dog)yeswhole body, body, head, front legs, back legs, tail, ears
no legs (the monster with no legs)yeswhole body, turns, body, arms, tail, ears

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