Movement & direction

Over

Click or tap to animate the arc over the obstacle.

Fig. 1 Arc clearance — the path rises above the obstacle mid-crossing

Try it — drag, click, or tap inside the figure.

Open in p5 Web Editor Fork and experiment with this sketch

Concept

OVER means above something while crossing from one side to the other, keeping clearance over it.

Translation strategy

Ways to express over in a sketch:

  • Arc path: Raise Y mid-crossing with a sine or parabola
  • Clearance: Peak height clears the obstacle top
  • Phase flags: Track before, above, and after the obstacle
Key p5.js methods
Key methods

Arc motion
lerp() on X; sin() on Y for height
map() — optional height scaling

Pointer input
mousePressed() — start motion or set a target
mouseX, mouseY — click position
Code pattern
Code pattern

1. Define obstacle and endpoints
let obstacle = { x: 200, y: 180, w: 60, h: 40 };
let start = { x: 80, y: 200 }, end = { x: 320, y: 200 };

2. Compute arc height
let arcH = start.y - obstacle.y + clearance;

3. Position on the arc
let x = lerp(start.x, end.x, t);
let y = start.y - sin(t * PI) * arcH;

4. Test above obstacle span
let over = x > obstacle.x && x < obstacle.x + obstacle.w && y < obstacle.y;