🔬 This loop creates 12 floating shapes. What happens if you change the third argument of ellipse from 25 to 50 (doubling their diameter)? What if you change 12 to 6 (fewer shapes)?
for(let k=0;k<12;k++){
fill(255,random(180,255),random(180,255),120);
ellipse((frameCount*0.7+k*70)%width,300+sin(frameCount*0.04+k)*50,25);
}
🔬 This loop draws all 300 starfield points using their pre-computed colors. What happens if you multiply pointData.a (alpha) by 2, like pointData.a * 2? Will the points become more or less transparent?
for (let pointData of staticPoints) {
stroke(pointData.r, pointData.g, pointData.b, pointData.a);
point(pointData.x, pointData.y);
}
function draw(){
if(S==0){
background(200,255,220);
// TOO HAPPY
fill(255,230,0);
ellipse(width/2,100,90);
fill(0);
textSize(32);
text("Everything is fine 🙂",width/2,200);
textSize(16);
text("Stay here. It's better here.",width/2,240);
// floating shapes
for(let k=0;k<12;k++){
fill(255,random(180,255),random(180,255),120);
ellipse((frameCount*0.7+k*70)%width,300+sin(frameCount*0.04+k)*50,25);
}
// GLITCHY X
glitch++;
for(let g=0;g<5;g++){
fill(random(255),0,0);
textSize(20+random(-8,8));
text("X",width-30+random(-5,5),25+random(-5,5));
}
} else if(S==1){
background(0);
fill(255);
textSize(18);
text("PUZZLE "+(p+1),width/2,height/2-120);
textSize(16);
text(msg,width/2,height/2-60);
fill(150);
text(hint,width/2,height/2-30);
// input
stroke(255);
noFill();
rect(width/2-120,height/2,240,40);
noStroke();
fill(0,255,100);
text(i,width/2,height/2+20);
// special sequence display
if(showSeq && seq!=""){
fill(255,0,0);
text(seq,width/2,height/2+80);
timer--;
if(timer<=0){
showSeq=false;
seq="";
}
}
// subtle flicker
if(random()<0.05){
fill(255,0,0,40);
rect(0,0,width,height);
}
} else if(S==2){
background(10);
// Optimized drawing of static points (generated once in check() or windowResized())
for (let pointData of staticPoints) {
stroke(pointData.r, pointData.g, pointData.b, pointData.a);
point(pointData.x, pointData.y);
}
noStroke();
fill(255);
textSize(26);
text("It noticed you.",width/2,80);
let x=width/2+sin(frameCount*0.02)*200;
let y=height/2+cos(frameCount*0.017)*140;
fill(180,0,255);
ellipse(x,y,70+sin(frameCount*0.1)*25);
fill(200);
textSize(14);
text("You were not supposed to solve them.",width/2,height-40);
// Open the Google Docs link once when the final screen is reached
if (!linkOpened) {
window.open("https://docs.google.com/document/d/1Q-hdZeGLsSQWWoHEOzofhrfxaKRLjqy4MjRL3j6hFxc/view?usp=sharing", '_blank');
linkOpened = true;
}
}
}