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.

First Hacks become a Pic

23. September 2013

CodingMad To draw is possible with press down the mousekey and move the the arrow. With key 1-5 your able to change color. Key a,s,d lets you change the look of your line > triangle, square and ellipse. <code>

//Code

boolean isDrawing=true;
color farbe;
int cursor=1;

void setup()
{
 size(500,500);
 smooth();
 background(255);
}

// Definition 1-5 Farben

void draw() {
 if (keyPressed) {
 if (key == '1' || key == '+') {
 farbe = color(139,239,255);
 } else if (key == '2' || key == '&amp;amp;amp;quot;') {
 farbe = color(245,192,166);
 } else if (key == '3' || key == '*') {
 farbe = color(211,245,166);
 } else if (key == '4' || key == 'ç') {
 farbe = color(211,166,245);
 } else if (key == '5' || key == '%') {
 farbe = color(0);
 } else if(key=='z'|| key == 'Z') {
 farbe = color(255);
 } else if(key=='a'|| key == 'A') {
 cursor = 1;
 } else if(key=='s'|| key == 'S') {
 cursor = 2;
 } else if(key=='d'|| key == 'D') {
 cursor = 3;
 }
 }

 if (mousePressed){
 if(mouseButton == LEFT)

 fill(farbe);stroke(farbe);
 switch(cursor){
 case 1: rect(mouseX,mouseY,10,10);
 break;
 case 2: ellipse(mouseX,mouseY,10,10);
 break;
 case 3: triangle(mouseX,mouseY,10,10,20,20);
 break;
 }
 } else {
 noStroke();
 }
}

</code>