Processing Cheat Sheet: Print (String)
Processing Cheat Sheet: Print (String)
Structure Basic Functions Shapes Border, Stroke, & Fill Basic Geometry
void setup() size(width, height); fill(red,green,blue); Anchor point
{ // runs only once. Sets main window size in pixels. Sets the filling color for next shape to draw
} background(color); 0-255.
void draw() Sets window background color.. noFill();
{ // runs repeatedly. frameRate(fps); Disables filling for the next shape.
Sets the applications FPS. stroke(Red,Green,Blue);
}
print(string); Sets the stroke/border color for next shape
Writes a string to the Console. to draw 0-255.
ellipse(x,y, w,h);
println(string); noStroke();
Comments/Debug Draws an ellipse centered in positiion (x,y)
Disables border for the next shape as well
/* this is a multiline Writes a string to the Console with a
as lines.
and with size “width”(w) and “height”(h).
comment. nothing between CRLF.
here will be run or
executed */ delay(milliseconds); Coordinate System
// this is a single Places a wait or delay in
// line comment milliseconds.
rect(x, y, w, h);
Draws a rect anchored at the top left
Data \ Variable Types Global Variables corner, in position (x, y) and with a size
void (null return) width: Returns sketch’s width in pixels. “width” (w) and “height” (h).
int (integer -32,768 to 32,767) height: Returns sketch’s height in
float (floating point / decimal numbers) pixels
String (array of characters) mouseX, mouseY : Returns the
current mouse pointer’s X or Y axis
coordinate
Conditional Operators pmouseX, pmouseY : Returns line(x1, y1, x2, y2);
previous mouse pointer’s X or Y axis Draws a line from (x1, y1) to (x2, y2)
coordinate
frameCount : Return’s sketch’s Top left corner of each sketch is the (0,0)
current frame. point. That axis changes when we make Time & Date
Basic Logic frameRate : Returns sketch’s current use of the translate() function. day();
If(mathematical statement) FPS.
{ Returns the numeric day of the
//true statement code here month.
Minimum measurement unit in a computer hour();
}
Other shapes screen is a Pixel.
else Returns the current hour.
{
point(x1, y1);
triangle(x1, y1, x2, y2, minute();
//false statement code here
x3, y3); Returns the current minute.
}
quad(x1, y1, x2, y2, x3, second();
y3, x4, y4); Returns the current second.
rev 0.2