xxxxxxxxxx
29
let myString = "hello class!";
function setup() {
createCanvas(600, 600);
textFont("Courier New", 25);
}
function draw() {
background(255);
push()
textAlign(CENTER);
text(myString, width/2, height*0.25);
pop()
for (let i=0; i<myString.length; i++){
let noiseValue = noise(frameCount * 0.01, i * 0.1);
let scaledNoise = (noiseValue - 0.5) * 100;
let myChar = myString.charAt(i);
let startX = width/2 - textWidth(myString)/2;
let x = startX + textWidth(myChar)*i;
text(myChar, x, height*0.5);
text(myChar, x, height*0.75 + scaledNoise);
}
}