Posts

Showing posts from May, 2021

art code 12

Image
Spot[] spots; // Declare array void setup() {   size(1280, 720);   int numSpots = 50; // Number of objects   int dia = width/numSpots; // Calculate diameter   spots = new Spot[numSpots]; // Create array   for (int i = 0; i < spots.length; i++) {     float x = dia + i*dia;     float rate = random(1.1, 2.0);     // Create each object     spots[i] = new Spot(x, 200, dia, rate);   }   noStroke(); } void draw() {   fill(0, 30);   rect(0, 0, width, height);   fill(#50c878);   for (int i=0; i < spots.length; i++) {     spots[i].move(); // Move each object     spots[i].display(); // Display each object   } } class Spot {   float x, y;         // X-coordinate, y-coordinate   float diameter;     // Diameter of the circle   float speed;        // Distance moved each frame   int ...