!7 p { pMain(HeartBeat); } public sclass HeartBeat extends PApplet { public void settings() { size(1200, 400); } int x = 0; float py = 0; float scale = 2; public void setup() { background(0); } public void draw() { noStroke(); fill(0,0,0,15); rect(0,0,width,height); translate(0,height/2); scale(scale); x++; x%=width/scale; float fx = py + random(-20,20); stroke(100,255,100); noFill(); line(x-1,py, x,fx); py = minmax(fx, -height/2/scale, height/2/scale); } }