Recitation 6: Animating an Interactive Poster
For this recitation, I learned how to draw hearts with processing. It was hard at first because of all the variables, but after distinguishing the difference between each the hearts duplicated with no problem.
The most interesting I included was something we learned in class. The hearts crowded closer and closer together as you move the mouse from the right of the screen to the left.
int size = 100; int l = 100; int h = 200; int a; void setup() { size(1024, 768); background(255); textSize(100); } void draw() { background(255); a = int(map(mouseX, 0, width, 20,100)); drawHearts(); fill(0); text("IMA Fall 22 End of", 140, 120); text("Semester Show", 170, 230); text("Location: 8th floor", 120, 340); text("Dec. 16 @6pm-8pm", 100, 450); } void mouseMoved () { } void drawHearts() { for ( int y = 0; y<height; y=y+a) { for ( int x = 0; x<width; x=x+a) { smooth(); noStroke(); fill(random(255), 0, 0); beginShape(); vertex(x, y); bezierVertex(x, y-20, x+40, y-10, x, y+25); vertex(x, y); bezierVertex(x, y-20, x-40, y-10, x, y+25); //bezierVertex(x, -5+size, 90+size, 5+size, 50+size, 40+size); //bezierVertex(50, -5, 10, 5, 50, 40); endShape(); } } }