xxxxxxxxxx
47
let x, y;
let noiseX = 0;
let noiseY = 10;
function setup() {
createCanvas(1080, 1920);
// Reduce size of preview
let scalePreview = 0.25;
let cnv = document.getElementById('defaultCanvas0');
cnv.style.width = round(width * scalePreview) + "px";
cnv.style.height = round(height * scalePreview) + "px";
background(225);
frameRate(30);
x = width / 2;
y = height / 2;
}
function draw() {
noiseX += 0.01;
noiseY += 0.01;
let speed = 50;
x += (noise(noiseX) - 0.5) * speed;
y += (noise(noiseY) - 0.5) * speed;
// Faire revenir vers le centre
let recallForce = speed / 3;
x += (width / 2 - x) / 1000 * recallForce;
y += (height / 2 - y) / 2000 * recallForce;
fill(255, 4);
noStroke();
rect(0, 0, width, height);
textSize(350);
textAlign(CENTER, CENTER);
noFill();
stroke(0, 100);
strokeWeight(5);
text("TIME", x, y);
}