Processing is not a single programming language, but an arts-centric system for learning, teaching, and making visual form with code. --Processing.py reference
- {} (curly braces - defines a table for arrays, classes, objects, dictionaries, data and more)
- [] (access items from an ordered table aka "array")
- -- (comment)
- --[[ (multi-line comment) ]]--
- = (assign global variable)
- local (assign local variable)
- ==
- nil
- true
- false
- setup()
- draw()
- for i=1,5 do end
- loop
- noLoop()
- isLooping() -- equals true or false
- exit() (quits/stops/exits the program)
- redraw() (executes draw one time)
- windowTitle()
- function (used to define a new user-defined function)
- break (finish a loop that contains it)
- if
- then
- end
- elseif
- == (equality)
- ~= (inequality)
- for (runs a set number of times)
- while do (runs while true, checks before executing)
- repeat until (loops but checks condition at end. executes at least once)
- and
- or
- not
- size()
- print()
- deltaTime
- describe() --implementing as text to console, takes string input, should be in setup
- displayDensity()
-
pixelDensity() - displayHeight
- displayWidth
- focused --boolean var
- frameCount
- frameRate()
- fullscreen() --returns true if in fullscreen, false otherwise. if passed true, turns on fullscreen, or turns off if passed false. equivalent to p5.js implementation
- width -- width of canvas in pixels
- height -- height of canvas in pixels
- resizeWindow() -- changes width and height of window
- windowResized() -- function that runs when window is resized
- loadJSON() --Not included currently. A simple parser could be written, or a robust library used.
- loadStrings() --takes filename as arg, returns table
- loadTable() --takes 1 or 2 arguments: filename, optional "header" string if header in csv or tsv present. Detects suffix (csv, tsv or lua) and processes accordingly. Saves to a table.
- loadXML() --Not included currently.
- saveJSON() --Not included currently.
- saveStrings() --takes table and output filename as arguments
- saveTable() --takes table and filename as arguments, and optional format "csv","tsv" or "lua". Auto-selects output based on filename suffix if third argument empty.
- millis() - returns time since start of program in milliseconds
- day() - returns day 1 - 31
- month() - returns month 1 - 12
- year() - returns year YYYY
- hour() - returns hour 0 - 23
- minute() - returns minute 0-59
- second() - returns seconds 0-59
- key
- keyCode --not needed as key can detect all
- keyIsDown() --not in Processing
- keyIsPressed --boolean, called keyPressed in Processing
- keyPressed()
- keyReleased()
- keyTyped()
- mouseButton --A variable that returns which mouse button was last pressed: LEFT, RIGHT or CENTER
- mouseClicked() --called once after a mouse button pressed and released
- mouseDragged() -- called while mouse moves and a mouse button is pressed
- mouseIsPressed --boolean, called mousePressed in Processing
- mouseMoved() --called when mouse moved, no button pressed
- mousePressed() --called once after mouse button pressed
- mouseReleased() --called once when a mouse button released
- mouseWheel() --runs once while wheel is moving if passed x,y then can return change of -1 or 1 for x (left or right), -1 or 1 for y (up or down)
- mouseX --horizontal coordinate of mouse
- mouseY --vertical coordinate of mouse
- movedX --mouseX-pmouseX, not in Processing
- movedY --mouseY-pmouseY, not in Processing
- pmouseX --mouseX in previous frame
- pmouseY --mouseY in previous frame
- arc()
- circle()
- ellipse()
- line()
- point()
- rect()
- square()
- triangle()
- ellipseMode()
- rectMode()
- strokeWeight()
- noSmooth()
- smooth()
- strokeJoin() --MITER, BEVEL, NONE. No ROUND. MITER is default. Also affected by strokeCap (because of Love2d's internals)
- curve()
- beginContour()
- beginShape() -- resets table of vertices for a custom shape
- bezier()
- curveVertex()
- endContour()
- endShape() -- draws a polygon with the table of vertices for a custom shape
- quadraticVertex()
- texture() -- draw texture mesh to polygon
- textureMode() -- change coodinate system for uv coordinates of drawing textures. default is IMAGE mode, or NORMAL (0-1) mode.
- textureWrap() -- define if textures CLAMP or REPEAT on texture mesh. default: CLAMP
- vertex() -- adds a x,y pair to table of vertices for a custom shape, or x, y, u, v for wrapping texture
- alpha() (gets alpha aka 4th value of a color)
- blue() (gets blue aka 3rd value of a color)
- red() (gets red value of a color)
- brightness() (extracts HSB brightness value of a color)
- color() (creates a color object) --G, G,A R,G,B R,G,B,A or html color name. affected by colormode.
- green() (gets the green value of a color)
- hue() (gets the hue value of a color)
- lerpColor()
- lightness()
- paletteLerp()
- saturation()
- background() --G, G,A R,G,B R,G,B,A or html color name. affected by colorMode.
- clear()
- HSB --mode, a constant
- HSL --mode, a constant
- colorMode() --default: RGB. alternately: HSB, HSL. optional second val sets max color values.
- fill() - G, G,A R,G,B R,G,B,A or html color name. affected by colorMode.
- noFill()
- noStroke()
- stroke() --G, G,A R,G,B R,G,B,A or html color name. affected by colorMode.
- createGraphics -- creates an offscreen buffer to draw to, with beginDraw() and endDraw() methods
- push() (saves previous drawing style settings)
- pop() (restores previous drawing style settings)
- translate()
- rotate()
- scale()
- applyMatrix()
- HALF_PI (1.57079...)
- PI (3.14159...)
- QUARTER_PI (0.78539...)
- TAU (6.28318...)
- TWO_PI (6.28318...)
- random() --takes 1 or 2 arguments. if a table name is given, returns a random value from the table
- randomSeed()
- randomGaussian()
- noise() --1, 2 or 3 dimensional Simplex noise generation
- lerp()
- abs() --absolute value
- ceil() --round up
- floor() --round down
- fract()
- log()
- norm()
- pow()
- exp()
- sq()
- sqrt()
- round() --round up or down
- int() --convert to integer
- constrain() --limit range of variable
- map() --remap variable from one range to another
- dist() -- return distance in pixels between 2 sets of x,y coordinates
- max() --return max of 2 values
- min() --return min of 2 values
- boolean() --convert to boolean
- byte() --convert to signed byte
- char() --convert number to letter char
- float() --convert to number
- hex() --convert to hexadecimal, with optional padding
- str() --convert number to string
- unchar() --convert char to number
- angleMode()
- degrees()
- radians()
- sin()
- cos()
- tan()
- asin()
- acos()
- atan()
- atan2()
- loadFont() --create new font
- text() --display text, at x,y, optional max width for wrapping
- textFont() --change to loaded font
- textWidth() --returns width of text
- textHeight() -- returns height of text
- textMode() --not currently planning on implementing this
- textAlign() --first parameter sets horizontal alignment LEFT (default), CENTER, or RIGHT. Optional second parameter sets TOP, CENTER or BOTTOM vertical alignment.
- textWrap()
- textSize()
- image()
- imageMode()
- loadImage()
- noTint()
- tint()
- save()
- cursor() (see https://www.love2d.org/wiki/love.mouse.setCursor )
- noCursor()
- blend() -- copies a region of pixels from one image to another
- copy() -- copies pixels from a source image to a region of the canvas
- filter() --implemented basic implementation with shaders
- PixelDensity() - get or set pixel density for normal or high pixel density displays. Default is 1.
- loadPixels() - loads current canvas into pixel array
- pixels - global variable holding pixel array of colors for each pixel on screen
- updatePixels() - draws the pixel array to screen as series of RGBA values
- get() - get value of a pixel or a region of the window
- set() - set color of a pixel or draw an image to canvas