Program or Be Programmed

  • Exercise 12

    moving our ball around float circle_x = 300; float circle_y = 20; void setup() { size(400, 200); stroke(#D60DFF); strokeWeight(7); } void draw() { background(#21EA73); ellipse(circle_x, circle_y, 40, 40); circle_x = circle_x – 2; circle_y = circle_y + 2; }

  • Exercise 11

    using random in a different way… float slow_circle_x = 0; float fast_circle_x = 0; void setup() { size(400,400); noStroke(); } void draw() { background(#1BB1F5); float slow_circle_size = 50; // what do you think this next line does? if(random(10) > 9) { slow_circle_size = 60; } fill(#C1FF3E); ellipse(slow_circle_x,50, slow_circle_size, slow_circle_size); slow_circle_x = slow_circle_x + 1; fill(#FF4800);…

  • Exercise 10

    // An introduction to a conditional float slow_circle_x = 0; float fast_circle_x = 0; void setup() { size(400,400); noStroke(); } void draw() { background(#1BB1F5); fill(#C1FF3E); ellipse(slow_circle_x,50, 50, 50); slow_circle_x = slow_circle_x + 1; fill(#FF4800); ellipse(fast_circle_x,50, 50, 50); fast_circle_x = fast_circle_x + 5; if(slow_circle_x > 400) { slow_circle_x = 0; } if(fast_circle_x > 400) { fast_circle_x…

  • Exercise 09

    // Animation Basics float circle_x = 0; void setup() { size(400,400); noStroke(); fill(#C1FF3E); } void draw() { background(#1BB1F5); ellipse(circle_x,50, 50, 50); circle_x = circle_x + 1; }

  • Exercise 08

    // white lines on black background // the lines begin on the top border and end on the bottom border // the lines must be vertical. void draw() { background(0); stroke(255); float distance_left = random(100); line(distance_left,0, distance_left,99); }

  • Assignment 1

    Instructions Create a new sketch file using Processing software Determine the size that you wish for the display window Create an intersting, original image for your own design using line(); and other associated codes Save the code and capture a picture of the output

  • Bonus Challenge 1

    try to replicate this painting.

  • Exercise 06

    // the lines begin on the left border and end on the right border // let’s make the lines be horizontal this time

  • Exercise 05

    // animation // white lines on black background // the lines begin on the left border and end on the right border void draw() { background(0,10); stroke(255); line(0,random(100), 99,random(100)); }

  • Review 1

    The color() function is used to create a variable of the type color. This is handy if you need to create colors you can use anywhere in your sketch. In this example, I’ve declared a color variable named c, before the setup() function. The fill() function is used to set the fill color of the…

Got any book recommendations?