Sunday, August 10, 2014

Processing Learning 2

System Variables:

  • width: Width (in pixels) of sketch window

  • height: Height (in pixels) of sketch window

  • framwCount: Number of frames processed

  • frameRate: Rate that frames are processed (per second)

  • screen.width: Width (in pixels) of entire screen

  • screen.height: Height (in pixels) of entire screen

  • key: Most recent key pressed on the keyboard

  • keyCode: Numeric code for key pressed on keyboard

  • KeyPressed: True or False? Is a Key pressed?

  • mousePressed: True or False? Is the mouse pressed?

  • mouseButton: Which button is pressed? Left, right, or center?


random():
float x = random(1, 100);
rect(100, 100, w, 50); //A random float number between 1 and 100

int w = int(random(1, 100));
rect(100, 100, w, 50); //A random integer number between 1 and 100

constrain():
r = constrain(r, 0, 255);
g = constrain(g, 0, 255);
b = constrain(b, 0, 255); //Constrain all color values to between 0 and 255

No comments:

Post a Comment