leaf spring; void setup() { size(500,500); noStroke(); smooth(); spring = new leaf(0); } class leaf { float x; int y; leaf( int a) { y = 39+a; } void move() { y += 3; x = random(0,100); if(y > height) {y=39; } } void display() { fill(21,113,28); beginShape(); vertex(190+x,y); bezierVertex(190+x, y, 154+x,y-22, 126+x,y+44); bezierVertex(126+x, y+44, 190+x, y+68, 190+x, y); vertex(290+x,y); bezierVertex(290+x, y, 254+x, y-22, 226+x, y+44); bezierVertex(226+x, y+44, 290+x, y+68, 290+x, y); endShape(); } } void draw() { background(255); frameRate(4); spring.move(); spring.display(); }