Design concept


I wanted to make this project an experience of switching between two states. School represents my everyday life, surrounded by assignments and deadlines, while Randomness is a space where I can temporarily escape that structure.
I used a fake VS Code interface as the starting point. The user types a command to leave School, then controls a character in Randomness to return. The time travel animation connects these two states, making the transition part of the experience.
1. How to make the time travel visual effect?
Problem
At first the particles looked too much like colorful dots. The palette leaned pastel, almost macaron, and the large circles covered the scene. Nothing about it felt like traveling.
Insight
Time travel can’t rely on randomness alone. It needs a clear rule of motion: particles move from the center outward, and the closer they get to the edge, the bigger and longer they look.
Solution
I use z to simulate depth and scale each coordinate by 300 / z, so the particles spread outward. The dots became light trails that stretch as they move, with a limited neon palette and a glow. Randomness decides only the color and the starting position; the motion stays consistent.
class Particle {
constructor() {
this.x = random(-width, width);
this.y = random(-height, height);
this.z = random(1, width);
this.col = color(random(["#00E5FF", "#2979FF", "#9D00FF", "#FF00CC", "#12ff1e"]));
}
show() {
// As z decreases, s increases and moves the particle away from the center
let s = 300 / this.z;
let x = this.x * s;
let y = this.y * s;
let distance = dist(0, 0, x, y);
let maxDistance = dist(0, 0, width / 2, height / 2);
let ratio = constrain(distance / maxDistance, 0, 1);
// The tail gets longer as the particle moves outward
let trail = map(ratio, 0, 1, 0.01, 0.5);
let tailX = x * (1 - trail);
let tailY = y * (1 - trail);
drawingContext.shadowBlur = 15;
drawingContext.shadowColor = this.col.toString();
stroke(this.col);
strokeWeight(map(ratio, 0, 1, 0.5, 3));
line(tailX, tailY, x, y);
drawingContext.shadowBlur = 0;
this.z -= 40 * min(deltaTime, 100) / (1000 / 60);
if (this.z < 1) this.z = width;
}
}
2. How to connect School and Randomness through time travel?
Problem
A normal HTML link opens the next page immediately and skips the animation. I needed both directions to pass through the time travel before arriving.
Insight
Starting the animation and changing the page are two separate steps. Both scenes can share one transition and only pass in a different destination.
Solution
activateTimeTravel(target) starts the animation and hides the interface, then setTimeout() opens the page after a delay. In School, typing go randomness triggers it. In Randomness, the character reaching the portal triggers it automatically, so there is no extra key to press.
Both scenes share one function: play the animation first, then open the target page.
let timetravelActive = false;
function activateTimeTravel(target) {
if (timetravelActive) return;
timetravelActive = true;
// Hide the interface while the animation plays
document.body.classList.add("portal-active");
// Keep drawing the animation, then navigate after 2.5 seconds
setTimeout(() => {
window.location.href = target;
}, 2500);
}
// Both scenes call this at the end of draw()
function coverTimeTravel() {
if (!timetravelActive) return;
push();
background(0);
translate(width / 2, height / 2);
noStroke();
for (let particle of particles) particle.show();
pop();
}
The trigger in School:
// Run this command check when the user presses Enter
if (command === "go randomness") {
activateTimeTravel("randomness.html");
}
The trigger in Randomness:
// Use the displayed image's right edge to trigger the return
let characterWidth = currentFrame.width * 0.3;
let rightEdge = xLoc + characterWidth / 2;
if (rightEdge >= portalX && !timetravelActive) {
activateTimeTravel("school.html");
}