Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int cellSize = 50;
- int edge = 50;
- void setup() {
- size(1200,900, P2D);
- smooth(8);
- rectMode(CENTER);
- background(238);
- for (int x=edge+cellSize/2; x<=width-edge; x+=cellSize) {
- for (int y=edge+cellSize/2; y<=height-edge; y+=cellSize){
- //if (random(1)>0.1)
- drawThing(x,y);
- }
- }
- }
- void draw() {
- }
- void keyPressed() {
- if (key =='s') save(random(1234)+".png");
- }
- void drawThing(float x, float y) {
- float sz = map(y,0,height,cellSize*1, cellSize*0.5);
- sz = cellSize*0.8;
- float sz2 = map(y,0,height,cellSize*.1, cellSize*1);
- sz2 = cellSize*.7;
- float r = map(y,0,height, 5,25 );
- float px = map(x,0,width,-cellSize/3,cellSize/3);
- float py = map(y,0,height,-cellSize/3,cellSize/3);
- float offSet = map(y,0,height, 0,PI);
- noStroke();
- fill(35);
- int num = 8;
- for (int i=0; i<num; i++) {
- pushMatrix();
- translate(x,y);
- rotate(radians(r));
- stroke(35);
- noFill();
- rect(0,0,sz,sz);
- rect(0,0,sz/2,sz/2);
- noStroke();
- fill(238);
- ellipse(px,py,sz2, sz2);
- popMatrix();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement