woensdag 21 september 2011

processing Quick reference


Commentaar
// kort commentaar
/* Lang commentaar */
 println ("Schrijf commentaar " +m);
print()

Variabele
String comment = "Text";
float geluidsfactor  = 50;
double d;
boolean BEPAALMAX=false;
int PIEK = 20;
boolean[] Mic = new boolean [4] ;
Led[] LED;
int[] x= { 2,  3,  4,  7,  8,  8, 10, 10, 14, 13}
int[][] gr = {{ 2,40,76 }  , {9,80,113 }}

Stuctuur
for (int m = 0 ; m < 4; m++) {}

if (a == false){}else {}

switch(k) {
  case 1: //rood
    c1 = color(255,0,0);
    break;
 default:}

try {}
catch(Exception e) {    println("Fout: "+e.getMessage());}

hoofdstuctuur
void setup()
{
  noStroke();
  size(800, 600);
}
void draw(){}
void stop(){}

input
void mousePressed() {  println("X,Y: "+mouseX+" "+mouseY); }
void keyPressed() {if(key=='s') {    }  }

function 
void mijnFunctie(int X,intY){
return;
}

import processing.serial.*;

class
class Led {
  float x,y;
  void display(float R,float  G,float B) {}
  Led(int X, int Y) {
    x = X;
    y = Y;
  }
}

kleur
fill((int)R,(int)G,(int)B);
noStroke();
stroke(255)


rect(x,y,ledsize,ledsize);
line(micX, micY,X2,Y2);

 int a =int(random(4));
float m = map((float)d_min, 0, 500, 0, 255);


Geen opmerkingen:

Een reactie posten