Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // based on code from:
- // P_2_1_1_01.pde
- //
- // Generative Gestaltung, ISBN: 978-3-87439-759-9
- // First Edition, Hermann Schmidt, Mainz, 2009
- // Hartmut Bohnacker, Benedikt Gross, Julia Laub, Claudius Lazzeroni
- // Copyright 2009 Hartmut Bohnacker, Benedikt Gross, Julia Laub, Claudius Lazzeroni
- //
- // http://www.generative-gestaltung.de
- int tileCount = 20;
- int actRandomSeed = 0;
- int actStrokeCap = ROUND;
- float sw0, sw1, theta;
- void setup() {
- size(500, 500);
- }
- void draw() {
- background(255);
- noFill();
- strokeCap(PROJECT);
- randomSeed(actRandomSeed);
- sw0=map(sin(theta),-1,1,3,22);
- sw1=sw0*2;
- for (int gridY=0; gridY<tileCount; gridY++) {
- for (int gridX=0; gridX<tileCount; gridX++) {
- int posX = width/tileCount*gridX;
- int posY = height/tileCount*gridY;
- int toggle = (int) random(0, 2);
- if (toggle == 0) {
- strokeWeight(sw0);
- stroke(0);
- line(posX, posY, posX+width/tileCount, posY+height/tileCount);
- }
- if (toggle == 1) {
- strokeWeight(sw1);
- stroke(255);
- //line(posX, posY+width/tileCount, posX+height/tileCount, posY);
- }
- }
- }
- theta += 0.0523;
- //if (frameCount % 2 == 0 && frameCount < 121) saveFrame("image-###.gif");
- }
- void mousePressed() {
- actRandomSeed = (int) random(100000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement