xxxxxxxxxx
69
function setup() {
createCanvas(windowWidth, windowHeight);
}
let framwCountCustom = 0;
function draw() {
framwCountCustom += 0.1;
background(0);
let txt = "waves";
let numberOfLines = 80;
let lineSpacing = 20;
push();
fill("rgb(57,255,20)");
blendMode(DIFFERENCE);
translate(0, height/2 - (lineSpacing * numberOfLines)/2);
for (let j = 0; j < numberOfLines; j++) {
let x0 = sin((framwCountCustom * j) * 0.01) * 10;
let y0 = lineSpacing * j;
push();
translate(x0, y0);
let letterLocX = 0;
for (let i = 0; i < txt.length; i++) {
let whichLetter = txt.charAt(i);
let movementX = tan((framwCountCustom + i * 5 + j * 3) * 1) * 2 * 2 * 20;
let txtSize = 120;
map(tan(((i+3) * (j*3) + framwCountCustom) * 1), 2, 5 * 5, 30);
let x1 = letterLocX + movementX;
let y1 = 0;
textSize(txtSize);
text(whichLetter, x1, y1);
letterLocX += textWidth(whichLetter);
}
pop();
}
pop();
}
function keyPressed() {
if (key === 'f' || key === 'F') {
enterFullscreen();
}
}
/* enter fullscreen-mode via
* https://editor.p5js.org/kjhollentoo/sketches/H199a0c-x
*/
function enterFullscreen() {
var fs = fullscreen();
if (!fs) {
fullscreen(true);
}
}
/* full screening will change the size of the canvas */
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}