Einfache Funktion um einen Punkt mit der Maus zu platzieren, klickt man mit der linken Maustaste, wird der Frame als .jpg gespeichert und der Punkt bewegt sich nicht mehr.
float a;
float b;
void setup() {
size(600,600);
smooth();
noStroke();
fill(0);
}
void draw() {
if(finished) {
background(255);
} else {
background(255);
ellipse(a,b,60,60);
a = mouseX;
b = mouseY;
if(mousePressed) {
ellipse(a,b,60,60);
}
if(mousePressed) {
ellipse(mouseX,mouseY,60,60);
saveFrame("punkt-####.jpg");
finished = true;
} else {
finished = false;
}
}
}
Es werden acht Punkte zufällig auf dem Canvas verteilt. Klickt man mit der Maus wird der Frame gespeichert und es werden acht neue Punkte verteilt.
float count;
void setup() {
size(600,600);
noStroke();
fill(0);
background(255);
count = 0;
}
void draw () {
if(count < 8) {
float a = random(600);
float b = random(600);
ellipse(a,b,60,60);
count = count + 1;
}
if(mousePressed) {
saveFrame("Random-####.jpg");
count = 0;
background(255);
}
}
Eine Linie wird Schwarz gezeichnet und bewegt sich von links nach rechts, wobei sie bei jedem Schritt eine Tonstufe heller wird.
Ist die Linie bei der Tonstufe 255 angelangt, startet eine weitere Linie welche die Tonwerte umkehrt.
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;
}
}
Es werden zufällige XY Koordinateen ausgewählt und zwischen diesen dann Linien gezeichnet.
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);
}
Es wird ein Feld mit einer der drei Grundformen "besprenkelt". Darunter wird eine zufällig gewählte Grundform generiert um den Kontrast zu verdeutlichen.
float place = 400;
float big = 50;
float count = 0;
float KreisG = 0;
float xpos;
float ypos;
float ybig;
void setup () {
size (500,600);
neustart ();
}
String[] formen = {"kreis", "rechteck", "dreieck"};
int pick = int(random(formen.length));
String[] formen2 = {"kreis", "rechteck", "dreieck"};
int pick2 = int(random(formen2.length));
void draw () {
translate (50,50);
noStroke ();
fill (0);
count += 1;
if (formen[pick].equals ("kreis")) {
KreisG = random (50);
ellipse (random (place), random (place), (KreisG), (KreisG));
}
if (formen[pick].equals ("rechteck")) { rect (random (place), random (place), random (big), random (big));
}
if (formen[pick].equals ("dreieck")) {
xpos = random(400);
ypos = random(400);
ybig = random (50);
dreieck (xpos, ypos);
}
if (formen2[pick2].equals ("kreis")) {
ellipse (200,475,50,50);
}
if (formen2[pick2].equals ("rechteck")) {
rect (175,450,50,50);
}
if (formen2[pick2].equals ("dreieck")) {
triangle (175,500,225,500,200,450);
}
if (big < 20) {
big += 0.1;
}
// if (count >= 60) {
// noLoop ();
// saveFrame ("Formen-####.jpg");
// }
if (mousePressed) {
noLoop ();
saveFrame ("Formen-####.jpg");
}
}
void dreieck (float xpos, float ypos) {
triangle (xpos, ypos, xpos +ybig, ypos, xpos +ybig/2, ypos -ybig);
}
void neustart () {
background (255);
smooth ();
}
Analoge Schwarzweißbilder in Photoshop bearbeitet.