Willkommen auf unserem Seminar-Blog

Immer auf dem aktuellen Stand bleiben

Dieser Seminar-Blog befindet sich noch im Aufbau und wird in den kommenden Tagen entsprechend verfeinert.

Member Login

Lost your password?

Registration is closed

Sorry, you are not allowed to register by yourself on this site!

You must either be invited by one of our team member or request an invitation by email at viad.info {at} zhdk {dot} ch.

01 Einstieg – Zeichnen und Funktionen

Februar 21, 2012

Zum Einstieg haben wir grundlegende Funktionen in Processing wie Zeichnen, Funktionen, Schleifen und Interaktionen repetiert.
LINES

size(500,500);
background(255);
smooth();

stroke(0,255,0);
strokeWeight(3);
line(10,10,200,200);

stroke(255,255,0);
strokeWeight(4);
line(50,100,300,300);

stroke(0,0,255);
strokeWeight(6);
line(50,400,500,300);

stroke(0,255,255);
strokeWeight(8);
line(400,100,300,300);

save("lines.png");

ELLIPSE / ALPHAWERT

int xPos=10;
int yPos=10;

void setup()
{
size(500,500);
background(0);
}

void draw()
{
//background(255);
noStroke();
fill(0,255,0,100);
ellipse(xPos,yPos,50,50);
}

void mouseDragged()
{
xPos=mouseX;
yPos=mouseY;

}

MOUSEPRESSED

int value = 0;

void setup()
{
size(500,500);
noStroke();
smooth();
}

void draw()
{
fill(value);
rect(250, 250, 100, 100);
}

void mousePressed() {
if(value == 0) {
value = 255;
} else {
value = 0;
}
}
KEYPRESSED
<pre>
void setup()
{
size(500,500);
noStroke();
background(255);
fill(0);
}

void draw()
{
if(keyPressed)
{
if (key == 'b' || key == 'B')
{
rect(100,100,100,100);
}
}
}