xxxxxxxxxx
26
let angle = 0;
function setup() {
createCanvas(500, 500);
textSize(20);
fill(255);
textAlign(CENTER, CENTER);
}
function draw() {
background(0);
let txt = "perfect chaos";
let letters = txt.split(""); // create a list of characters
let totalTextWidth = txt.length * textWidth("A");
for (let i = 0; i < letters.length; i++) {
let x = width / 2 - totalTextWidth / 2 + i * textWidth("A");
let h = map(sin(angle + x * 0.01), -1, 1, 0, 100);
text(letters[i], x, height / 2 - h / 2);
}
angle += 0.1;
}