xxxxxxxxxx
49
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 myChar = myString.charAt(i);
let startX = width/2 - textWidth(myString)/2;
let x = startX + textWidth(myChar)*i;
text(myChar, x, height*0.5);
let noiseValue = noise(frameCount * 0.05, i* 0.05);
let scaledNoise = (noiseValue - 0.5) * 100;
text(myChar,x, (height*0.75)+scaledNoise);
}
// for (let i=0; i<myString.length; i++){
// let myChar = myString.charAt(i);
// let startX = width/2 - textWidth(myString)/2;
// let x = startX + textWidth(myChar)*i;
// text(myChar, x, height*0.5);
// let noiseValue = noise(frameCount * 0.05, i* 0.05);
// let scaledNoise = (noiseValue - 0.5) * 100;
// text(myChar,x, (height*0.75)+scaledNoise);
// }
// for (let a=myString.length/2; a<myString.length; a+=myString.length){
// let noiseValue = noise(frameCount * 0.01, a * 0.001);
// let scaledNoise = (noiseValue - 0.5) * 100;
// text(myString, width/2, height*0.75);
// }
}