If you ever need crazy colorful circles for whatever reason

(But where is my shooting star?)

//float sizeX;
int x = 0;
int y = 0;
int xspeed = 30;
int yspeed = 10;
int count = 500;
Circles [] circles;

//INITIALIZE VARIABLE
void setup(){
  size(800,800);
  background(255);
  //cloudX = width/2;
  //cloudY = height/2;
  circles = new Circles[count];
  for (int k = 0; k < count; k++){
    circles[k] = new Circles();
  }
}

//USE VARIABLE
void draw(){
  for (int i = 0; i < count; i++){
    circles[i].draw();
  }

  //shootingStar();
  //Dan's code:
  //fill(0,0,0,10); 
  //rect(0,0,width,height);
}

void shootingStar(){
  x = x + xspeed;
  y = y + yspeed;

  if (x > width || x < 0){
    xspeed = xspeed * -1;
  }

  if (y > height || y < 0){
    yspeed = yspeed * -1;
  }

  if(mousePressed){
  stroke(255,215,10,100);
  fill(255,215,10,100);
  //ellipse(x,y,32,32);
  beginShape();
  vertex(x,   y-50);
  vertex(x+14,y-20);
  vertex(x+47,y-15);
  vertex(x+23,y+7);
  vertex(x+29,y+40);
  vertex(x,   y+25);
  vertex(x-29,y+40);
  vertex(x-23,y+7);
  vertex(x-47,y-15);
  vertex(x-14,y-20);
  endShape(CLOSE);
  }
}

class Circles{
  float cloudX = random(0,255);
  float cloudY= random(0,255);

  float r = random(0,255);
  float g = random(0,255);
  float b = random(0,255);
  float a = random(0,255);

  void draw(){
  cloudX = random(width);
  cloudY = random(height);
  stroke(r,g,b,a);
  fill(r,g,b,a);
  ellipse(cloudX,cloudY,200,100);
  }
}

 

Leave a Reply