xxxxxxxxxx
65
function setup() {
createCanvas(windowWidth, 300);
}
function windowResized(){
resizeCanvas(windowWidth,300)
}
let time = 0
let amp = 100
let wl = 250
let freq = 0.3
let segW = 50
let segH = 22
let Bcol = [6,0,25]
let Pcol = [250,0,200]
function draw() {
time += round(deltaTime/1000,3)
background(Bcol);
textAlign(CENTER,CENTER)
textSize(80)
noStroke()
fill(Pcol)
text("[ HELLO!!! ]",windowWidth/2,150)
push()
beginClip()
let wavlen = PI * (segW/wl)
// right half of screen
for(let i = 0; i < ceil((windowWidth/2) / segW); i++ ){
rect(windowWidth/2 + (segW*i), (sin(
i * wavlen + (PI*time*freq)
) * amp ) - segH/2 + 150,segW,segH)
}
// left half of the screen
for(let i = 0; i < ceil((windowWidth/2) / segW) + 1; i++ ){
rect(windowWidth/2 - (segW*i), (sin(
-i * wavlen + (PI*time*freq)
) * amp ) - segH/2 + 150,segW,segH)
}
endClip()
fill(Pcol)
rect(0,0,windowWidth,300)
textAlign(CENTER,CENTER)
textSize(80)
noStroke()
fill(Bcol)
text("[ HELLO!!! ]",windowWidth/2,150)
pop()
}