Open this sketch in P5 Web Editor →
Click to launch a projectile toward the impact point. Watch what happens after the collision!
The preposition "after" indicates that something happens following a specific event or action. It establishes a sequence where one action occurs subsequent to another. In this visualization, particles scatter in different directions after a collision occurs, demonstrating the consequences that follow an impact.
To represent "after" relationships through movement:
let projectile = { x: 50, y: 150, isMoving: false };
let impact = { x: 200, y: 150, hasHappened: false };
let angle = atan2(dy, dx);
projectile.x += cos(angle) * speed;
projectile.y += sin(angle) * speed;
if (distance < projectile.speed + impact.size/2) {
impact.hasHappened = true;
// Start "after" effects here
}
for (let particle of particles) {
if (impact.hasHappened) {
particle.x += particle.vx;
particle.y += particle.vy;
particle.vx *= 0.98; // Slow down over time
}
}