0:01 / 0:30
Playback speed

Shadow

Cover the left half for one hop. Where would you mark the landing spot on the right?

#Shadows

A dark shape that tells you where something is in space.

In 2D a shadow isn’t decoration, it’s information. Both monkeys here are hopping exactly the same way, but only the left one looks like it leaves the ground. Without a shadow the eye can’t tell height from position.

Code

src/demos/shadow.goose
namespace shadow_lesson;
import stage;
import std;
import math;

export "shadow" fn draw(time: f64, dt: f64, px: f64, py: f64, hover: bool) {
    artwork("studio");
    let height = abs(sin(time * 2.5)) * 24;
    ell(40, 82, 11 - height * 0.2, 3.5 - height * 0.06, "rgba(14,15,38,.55)");
    let pose = if height < 2 { LAND } else { air_pose(sin(time * 2.5) * cos(time * 2.5) * 120) };
    actor(40, 84 - height, pose);
    actor(120, 84 - height, pose);
    line(80.5, 8, 80.5, 92, LINE, 2, 2);
}

Stage drawing helpers · All demos on GitHub

Comments

No comments yet.