Movement & direction
Over
Click or tap to animate the arc over the obstacle.
Try it — drag, click, or tap inside the figure.
Open in p5 Web Editor Fork and experiment with this sketchConcept
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
Code pattern
Code pattern
1. Define obstacle and endpoints
2. Compute arc height
3. Position on the arc
4. Test above obstacle span
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;