Fundamental

Fundamental Functions

makeGraphicsWindow

Creates a new graphics window.

name
type
default
description

width*

number

-

the desired width of the animation window, in pixels

height*

number

-

the desired height of the animation window, in pixels

canvasDomNode*

object

-

the DOM node for the html canvas element

Returns

nothing

makeGraphicsWindow(800, 600, document.getElementById('canvas'))

Note: You will always need to call this function as the first thing you do in order to make your graphics window

runGraphics

Starts the animation or game running.

name
type
default
description

startFunction*

function

-

the name of the function that initializes your new world. Takes one argument (the world)

updateFunction*

function

-

the name of the function that updates your world for the next frame. Takes one argument (the world)

drawFunction*

number

-

the name of the function that draws the frames of your animation. Takes one argument (the world)

Returns

nothing

runGraphics(startWorld, updateWorld, drawWorld)

Note: Your should call this function on the very last line of your program

endGraphics

Stops the animation from running.

Returns

nothing

endGraphics()

Note: You may want your animation to end at some point. The user can always end your program by closing the window/tab. To have your program make the animation stop, call this function.

Last updated