Transcript
Page 1: Processing Cheat Sheet

PROCESSING CHEAT SHEET

Basic:

exit() - gets out of the program

draw() - starts loop

setup() - initial set-up

loop() - turns draw loop on

noLoop() - turns off draw loop

redraw() - replays loop

pushStyle() - starts a new style

popStyle() - returns to previous style

Settings:

background() - sets background

clear() - clear screen

fill() - define fill color

noFill() - removes fill

color() - variable for color

stroke() - define stroke color

noStroke() - removes stroke

Environment:

cursor() - changes cursor

i.e.: (HAND,ARROW,CROSS,MOVE,TEXT,WAIT)

displayHeight - returns monitor height

displayWidth - returns monitor width

height - returns window height

width - returns window width

frameRate(int) - specifies frame rate

frameCount - returns number of frames counted

frameRate - returns frame rate

size(width,height) - specifies window size

size(width,height,P3D) - allows 3D ren-dering

Shapes in 2D

arc(x,y,width,height,start,stop)

ellipse(x,y,width,height)

line(x1,y1,x2,y2)

point(x,y)

quad(x1,y1,x2,y2,x3,y3,x4,z4)

rect(x1,y1,x2,y2,radius)

triangle(x1,y1,x2,y2,x3,y3)

2D Modes:

ellipseMode(CENTER/RADIUS/CORNERS)

rectMode(CENTER/RADIUS/CORNERS)

smooth() - smoothens edges

noSmooth() - jagged edges

strokeCap(ROUND/SQUARE/PROJECT)

strokeJoin(MITER/BEVEL/ROUND)

strokeWeight(weight)

Mouse:

mouseButton - LEFT/RIGHT/CENTER

mouseClicked() - calls a function when mouse is clicked

mouseDragged() - calls a function when mouse is dragged

mouseMoved() - calls function when mouse is moved

mousePressed() - calls function when mouse is pressed

mousePressed - variable for mouse press

mouseReleased() - calls a function when mouse is released

mouseButton - variable for mouse button

mouseX - returns mouse x value

mouseY - returns mouse y value

pmouseX - previous mouse X

pmouseY - previous mosue Y

Keyboard:

key - returns key released or pressed

keyCode - UP,DOWN,LEFT,RIGHT,ALT,

CON-TROL,SHIFT,BACKSPACE,TAB,ENTER,

RETURN,ESC,DELETE

keyPressed() - calls a function when key is pressed

keyPressed - returns true/false

keyReleased - returns true/false

Time:

day() - returns day 1-31

hour() - returns hour 0-23

minute() - returns minutes 0-59

month() - returns month 1-12

second() - returns seconds 0-59

year() - returns year

Monitor:

print() - prints without linespace

printArray() - print array values

println() - print with linespace

Images:

PImage img - define image name

loadImage() - gets image

image(img,width,height)

tint(r,g,b,alpha) - image transpar-ency

Font:

PFont font - define font name

loadFont() - calls declared font

createFont(“Font”, size) - stores font to a variable

textFont() - applies font

text(string, x1, y1, x2, y2)

textAlign() - LEFT/CENTER/RIGHT

textLeading() - sets text distances

textSize() - sets text size

Top Related