Interface for a single image or text.
Parameters
n
number new depth
Stop rendering this Wrap. After this is called, the Wrap is useless.
Move to new position.
Parameters
args
numbers new position
Move to new position over time
Parameters
mode
string "SMOOTH" for motion that accelerates and decelerates, or "LINEAR" for motion with a constant speedcallback
Function called once done movingsteps
integer how many steps moving should takeargs
numbers new position
CoreGraphics interface 1.0 Copyright 2016 Brett Houtz
CoreGraphics supplies an object-oriented interface for graphics for the HTML5 Canvas.
Parameters
n
number new depth
Stop rendering this Wrap. After this is called, the Wrap is useless.
Move to new position.
Parameters
args
numbers new position
Move to new position over time
Parameters
mode
string "SMOOTH" for motion that accelerates and decelerates, or "LINEAR" for motion with a constant speedcallback
Function called once done movingsteps
integer how many steps moving should takeargs
numbers new position
Interface for the canvas. Manages all image loading and drawing. Images and text may be made to automatically persist over frames. Peristant images are managed through Wrap objects. Before any drawing is done, files must be registered. Then load() must be called. After loading has finished, each frame follows the cycle of clear(), drawing method calls, and render(). The parameters args in draw, pdraw, text, and ptext follow conventions described here (excluding img): http://www.w3schools.com/jsref/canvas_drawimage.asp
Parameters
ctx
filenames
(optional, default[]
)extension
(optional, default''
)prefix
(optional, default''
)
Clears the canvas for a new frame.
All params except the first are an optional initial call to registerFiles
Parameters
ctx
CanvasRenderingContext2Dfilenames
(optional, default[]
)extension
[string] extension common to all image names (optional, default''
)prefix
[string] path and/or prefix common to all image names (optional, default''
)
Prepares an image to be rendered that won't persist after clear().
Parameters
name
string the filename of the registered imagedepth
number depth at which to draw (higher is drawn over lower)args
numbers position
Returns Wrap Wrap object for the image. Probably useless to save.
Returns number -1: load has not yet started 0-1: load is in progress 1: load has completed
Returns boolean whether the load has completed
Kills all images and text.
Begins loading the registered images.
Prepares an image to be rendered that will persist after clear() is called.
Parameters
name
string the filename of the registered imagedepth
number depth at which to draw (higher is drawn over lower)args
numbers position
Returns Wrap Wrap object for the image
Just like pdraw, but displays text.
Parameters
txt
string Text to be drawn.depth
number depth at which to draw (higher is drawn over lower)args
numbers position
Returns Wrap Wrap object for the text
Adds filenames to the roster of images.
Parameters
ctx
CanvasRenderingContext2Dfilenames
extension
[string] extension common to all image names (optional, default''
)prefix
[string] path and/or prefix common to all image names (optional, default''
)
Actually draws all images and text prepared by pdraw(), draw(), ptext(), and text().
Determines the properties of text drawn after the call.
Parameters
props
Object may have keys font, color, align, and baseline.
Just like draw, but displays text.
Parameters
txt
string Text to be drawn.depth
number depth at which to draw (higher is drawn over lower)args
numbers position
Returns Wrap Wrap object for the text