{braces} -- Used to block code togethr for loops, conditionals, and functions.
abs(x) -- Returns the absolute value of x.
alert(s) -- Opens alert box containing string s.
aligntext(s) -- Specify how text is aligned with the point (x,y) in a command such as "filltext(t,x,y)". The argument s should be "left", "right", "center", "start", or "end".
altKey -- A constant set to the code for the alt key.
arc(x, y, r, a, b) -- Draw the arc of the circle centered at (x,y) with radius r starting at angle a and continuing to angle b in a clockwise direction.
array.random() -- Selects a random entry from the array.
array.zipf() -- Selects a random entry from the array with the first entry twice as likely as the second, three times as likely as the third, four times as likely as the fourth, and so on.
circle(x, y, r) -- Draw the circle centered at (x,y) with radius r.
clear() -- Clear the canvas.
clip() -- Causes all subsequent drawing to be clipped inside the last figure drawn.
color(c) -- Set the line color to c.
color(r,g,b) -- Set the line color to have RGB values of r, g, and b.
color(r,g,b,a) -- Set the line color to have RGB values of r, g, and b, and alpha value of a.
confirm(s) -- Opens a dialog box with message s and buttons for OK or CANCEL. Returns true if OK is clicked and false otherwise.
copyImageData(R,G,B,A) -- This copies the canvas RGB and alpha values to arrays R, G, B, and A. R, G, B, and A should be arrays.
ctrlKey -- A constant set to the code for the control key.
date() -- Returns day of the month.
day() -- Returns day of the weeek.
downArrow -- A constant set to the code for the down arrow key.
draw() -- Main spork drawing function executed every pass through the animation loop.
ellipse(x, y, rx, ry) -- Draw an ellipse with center (x,y), horizontal radius rx, and vertical radius ry.
fill() -- Fill the last drawn shape.
fillcolor(c) -- Set the fill color to c.
fillcolor(r,g,b) -- Set the fill color to have RGB values of r, g, and b.
fillcolor(r,g,b,a) -- Set the fill color to have RGB values of r, g, and b, and alpha value of a.
fillrect(x1,y1,x2,y2) -- Fill rectangle with upper left corner at (x,y) with width w and height h.
filltext(t, x, y) -- Write the text t at the point (x,y) filling in the characters.
floodfill(x,y) -- Fills the region of the canvas containing the point (x,y) with the current fill color.
font(x) -- Set the font of the canvas to x. The variable x should be something like, "20px" or "20px times" or "bold 20px times".
for{START; CONDITION; STEP} {BLOCK} -- The code START is executed. Then, as long as CONDITION is true, BLOCK is executed followed by STEP.
function name(arguments){BLOCK} -- Defines a function called name which accepts arguments and runs the code BLOCK.
height -- Variable equal to height of canvas.
hour() -- Returns the current hour.
if (CONDITION) {BLOCK} -- If the CONDITION is true, then the BLOCK of code is executed.
if (CONDITION) {BLOCK1} else {BLOCK2} -- If the CONDITION is true, then BLOCK1 is executed. If condition is false, BLOCK2 is executed.
keyChar -- A variable set to the uppercase version of a key when an alphanumeric key is pressed.
keyCode -- A variable set to the ascii code for a key when it is pressed
keyDown -- A variable which is true when a key is pressed down.
leftArrow -- A constant set to the code for the left arrow key.
line(x1,y1,x2,y2) -- Draw a line from point (x1,y1) to (x2,y2).
line(x1,y1,x2,y2,x3,y3,...) -- Draw line segments from (x1,y1) to (x2,y2), and then from (x2,y2) to (x3,y3), and so on.
linewidth(n) -- Set the line width to n pixels.
loop() -- Causes the draw() function to be called every timestep milliseconds.
max(x1,x2,x3…) -- Returns the maximum of the arguments.
measuretext(t) -- This will return the length of the text t if it were printed on the canvas.
millisecond() -- Returns the millisecond of the current time.
min(x1,x2,x3…) -- Returns the minimum of the arguments.
minute() -- Returns the minute of the current time.
month() -- Returns the current month.
mouseDown -- A variable that is true if the mouse is pressed down.
mouseX -- A variable set to the x coordinate of the mouse.
mouseY -- A variable set to the y coordinate of the mouse.
noise(x,y) -- Returns a random number between -1 and 1 that varies continuously with x and y. The arguments x and y must be between 0 and 1.
onclick() -- A function which is called whenever the mouse button is clicked over the canvas.
onkeydown() -- A function called when a key is pressed down.
onmousedown() -- A function which is called whenever a mouse button is pressed.
onmousemove() -- A function which is called whenever the mouse is moved over the canvas.
point(x,y) -- Draw a circle at (x,y) whose radius is the linewidth.
prompt(q,d) -- Opens dialog box with question q and default answer d.
quad(x1,y1,x2,y2,x3,y3,x4,y4) -- Draw quadrilateral with vertices (x1,y1), (x2,y2), (x3,y3), and (x4,y4).
random() -- Returns a random number greater than or equal to 0 and less than 1.
rect(x1,y1,w,h) -- Draw rectangle with upper left corner at (x,y) with width w and height h.
restore() -- Undo all of the changes in scale, rotation, color, etc. to the drawing canvas back to the last save.
rgb(r,g,b) -- Returns the color with RGB values r, g, and b.
rgba(r,g,b,a) -- Returns the color with RGB values r, g, and b and alpha value a.
rightArrow -- A constant set to the code for the right arrow key.
rotate(n) -- Rotate the axis by n degrees clockwise.
save() -- Save the state of the drawing canvas to be restored at a later time.
scale(s) -- Cause all drawing to be scaled by s from the point of the call forward.
scale(x,y) -- Cause all drawing to be scaled by x horizontally and y vertically from the point of the call forward.
second() -- Returns the second of the current time.
setup() -- The first function called when a spork program is run.
shadowblur(n) -- Causes a shadow of width n pixels to be drawn around all subsequent figures.
shadowcolor(s) -- Sets the color of the shadow for shadow blur to s.
shiftKey -- A constant set to the code for the shift key.
size(w,h) -- Set the canvas width to w pixels and the height to h pixels.
startloop() -- Calls draw() and starts the spork animation loop.
startover() -- Stops the spork loop and starts a spork program over with setup.
stoploop() -- Pauses the spork animation loop.
stroketext(t, x, y) -- Write the text t at the point (x,y) outlining the characters.
timestep(n) -- Sets the spork animation time step to n milliseconds between calls to
translate(x,y) -- Move the origin of the drawing canvas to the point (x,y) relative to the current origin.
triangle(x1,y1,x2,y2,x3,y3) -- Draw triangle with vertices (x1,y1), (x2,y2), and (x3,y3).
upArrow -- A constant set to the code for the up arrow key.
valigntext(x) -- Specify how text is aligned vertically with the point (x,y) in a command such as "filltext(t,x,y)". The argument s should be "top", "bottom", "middle", "alphabetic", or "hanging".
var x; -- Declares the variable x.
while(CONDITION) {BLOCK} -- The code BLOCK is executed as long as CONDITION is true.
width -- A variable equal to the width of the canvas.