2017年4月6日星期四

//// Made by zhangbo0037, 04/01/2017

float alpha = 255;  
  
void setup() 
{
  size(800, 500);
  background(color(218,206,190));
  Draw();
}

void Draw()
{
  pushMatrix();

  translate(0, 200);
  for (int k = 0; k < 5; k++)
  {
    for (int i = 0; i < 15; i++)
    {
      polygon(i*60+random(-5,5)+k*(-30), (k*60+random(-5,5)), 2.5, alpha);
    }
    alpha = alpha + k * (-25);
  }
  popMatrix();
}

void draw() 
{
}

void Color_()
{
  color Color[];
  Color = new color[3];
  Color[0] = color(218,206,190); // Background Color
  Color[1] = color(42,27,34);  // Dark Purple
  Color[2] = color(64,54,107); // Light Purple
}

void  polygon(float TransX, float TransY, float Scale, float Alpha)
{
  pushMatrix();
  
  translate(TransX, TransY);
  scale(Scale);
  strokeWeight(0.05);
  fill(color(42,27,34), Alpha);
  
  float Vertex_1_x = random(5,10);
  float Vertex_1_y = random(-5,5);
  
  float Vertex_2_x = random(-5,5);
  float Vertex_2_y = random(10,20);
  
  float Vertex_3_x = random(10,15);
  float Vertex_3_y = random(15,25);
  
  float Vertex_4_x = random(20,25);
  float Vertex_4_y = random(12,18);
  
  PShape diamond;
  diamond = createShape();
  diamond.beginShape();
  diamond.vertex(Vertex_1_x, Vertex_1_y);    //Top: Vertex_1
  diamond.vertex(Vertex_2_x, Vertex_2_y);    //Left: Vertex_2
  diamond.vertex(Vertex_3_x, Vertex_3_y);    // Bottom: Vertex_3
  diamond.vertex(Vertex_4_x, Vertex_4_y);    // Right: Vertex_4
  diamond.endShape(CLOSE);
  shape(diamond, 0, 0);
  
  strokeWeight(0.05);
  stroke(color(64,54,107), Alpha);
  for (int i = 0; i < random(100,150); i++)
  {
    line(Vertex_1_x + random(-15,15), Vertex_1_y + random(-15,15), Vertex_3_x + random(-15,15), Vertex_3_y + random(-15,15));
  }
  
  for (int i = 0; i < random(100,150); i++)
  {
    line(Vertex_2_x + random(-15,15), Vertex_2_y + random(-15,15), Vertex_4_x + random(-15,15), Vertex_4_y + random(-15,15));
  }
  
  for (int i = 0; i < random(100,150); i++)
  {
    line(Vertex_1_x + random(-15,15), Vertex_1_y + random(-15,15), Vertex_2_x + random(-15,15), Vertex_2_y + random(-15,15));
  }
  
  for (int i = 0; i < random(100,150); i++)
  {
    line(Vertex_3_x + random(-15,15), Vertex_3_y + random(-15,15), Vertex_4_x + random(-15,15), Vertex_4_y + random(-15,15));
  }
  
  for (int i = 0; i < random(100,150); i++)
  {
    line(Vertex_2_x + random(-15,15), Vertex_2_y + random(-15,15), Vertex_3_x + random(-15,15), Vertex_3_y + random(-15,15));
  }
  
  for (int i = 0; i < random(100,150); i++)
  {
    line(Vertex_1_x + random(-15,15), Vertex_1_y + random(-15,15), Vertex_4_x + random(-15,15), Vertex_4_y + random(-15,15));
  }
  popMatrix();
}

没有评论:

发表评论