IFD:GenerativeBauhaus WS2012/Karim: Difference between revisions

From Medien Wiki
Line 74: Line 74:
     background(255);
     background(255);
   }
   }
}
</source>
==Linie==
===Schwarz bis Weiß===
Eine Linie wird Schwarz gezeichnet und bewegt sich von links nach rechts, wobei sie bei jedem Schritt eine Tonstufe heller wird. <br>
Ist die Linie bei der Tonstufe 255 angelangt, startet eine weitere Linie welche die Tonwerte umkehrt.
[[File:Verlauf-0244.jpg|200px|thumb|right|border| Verlauf 1]]
[[File:Verlauf-0402.jpg|200px|thumb|right|border| Verlauf 2]]
<source lang="java">
float a;
float b;
float c;
float d;
void setup() {
  size (255,255);
  background (255);
  a = 0;
  b = 0;
  c = 0;
  d = 255;
}
void draw () {
  if(b < 255) {
  stroke(a);
  line (b,255,b,0);
  a = a + 1;
  b = b + 1;
  } else {
      stroke(d);
      line (c,255,c,0);
      c = c + 1;
      d = d - 1;
  }
}
</source>
===Random Lines===
Es werden zufällige XY Koordinateen ausgewählt und zwischen diesen dann Linien gezeichnet.
[[File:RandomLines-0835.jpg|200px|thumb|right|border| Random Lines 1]]
[[File:RandomLines-0150.jpg|200px|thumb|right|border| Random Lines 2]]
<source lang="java">
float a;
float b;
float c;
float d;
float strokecolor;
int xlimit = 40;
int ylimit = 560;
void setup () {
  size (600,600);
  background(255);
}
void draw () {
  float strokecolor = random(0,0);
  float a = random (xlimit,ylimit);
  float b = random (xlimit,ylimit);
  float c = random (xlimit,ylimit);
  float d = random (xlimit,ylimit);
  stroke (strokecolor);
  line (a,b,c,d);
}
}
</source>
</source>