-
Notifications
You must be signed in to change notification settings - Fork 430
soulwire edited this page Jul 17, 2012
·
17 revisions
Passed to the Sketch.create
method.
-
fullscreen
Default:true
-
autostart
Default:true
Otherwise callstart()
-
autoclear
Default:true
Whether to clear the context before each call todraw
. Otherwise callclear()
-
container
Default:document.body
Where to put the sketch context -
type
DefaultSketch.CANVAS
Possible values:Sketch.CANVAS
,Sketch.WEB_GL
andSketch.DOM
-
create
Creates and returns a new sketch. Arguments:options
Optional hash including any number of the above options
start
stop
clear
Implement these methods on your sketch instance (or pass them to create
inside the options
hash).
setup
update
draw
touchstart
touchmove
touchend
mouseover
mousedown
mousemove
mouseout
mouseup
click
keydown
keyup
resize
-
mouse
Containsx
,y
,ox
,oy
,dy
anddy
, representing the mouse or primary touch. -
touches
List of current touches with same structure asmouse
. On the desktop, the 0th element represents the mouse. -
dragging
Whether the mouse is down / the user is dragging -
width
Current viewport width -
height
Current viewport height -
keys
A hash of booleans indicating whether each key is currently pressed, e.gsketch.keys.SPACE
-
millis
The total runtime of the sketch in milliseconds -
now
The current time in milliseconds -
dt
The delta time between the current and previous frame in milliseconds
-
CANVAS
Enumeration for the Canvastype
-
WEB_GL
Enumeration for the WebGLtype
-
DOM
Enumeration for the DOMtype
These are safely mixed into the window object for quick access, e.g: sin( random( TWO_PI ) )
-
random
Accepts single values, ranges and Arrays, e.g:random( 10, 20 )
orrandom( colours )
PI
TWO_PI
HALF_PI
QUATER_PI
sin
cos
tan
pow
exp
min
max
sqrt
atan
atan2
ceil
round
floor