The instance of oCanvas Core that is created using the create() method on the global oCanvas object.
The core instance contains instances of all the modules in oCanvas.
- Used for animating things, often short animations triggered as a response to something.
- Used to handle the background of the canvas.
- Contains all the display objects that have been added. Calling
core.display.rectangle(settings)would return a new rectangle object.
- Handles all of the redrawing of the canvas.
- Handles everything event related, and takes care of the bind() calls.
- Handles all keyboard events.
- Handles all mouse events.
- Handles different states of your app.
- Handles style related things for internal methods.
- Handles the main loop.
- Tools that other methods use. It is used for finding out if the pointer is inside the objects, which is a must if events are going to work.
- Handles all touch events.
- addChildAt() (since version 2.9.0)
- destroy() (since version 2.2.0)
- removeChildAt() (since version 2.9.0)
- reset() (since version 2.2.0)
- children : Array (since version 2.1.0)
- List of all objects added directly to the core instance.
- height : Number
- The height of the canvas in pixels. Setting this property resizes the canvas and redraws everything.
- id : Number
- The ID of the core instance within the global oCanvas object.
oCanvas.canvasListis an array of all the instances, so this ID is the index of this instance in that array.
- pointer : Object
- Refers to the pointer in use. Touch on touch devices and Mouse otherwise.
- settings : Object
- Object of settings that controls how oCanvas works. Its properties are as follows:
- canvas : String or HTMLCanvasElement
- Specifies the canvas element that oCanvas will work with. Either a CSS selector string, or an HTMLCanvasElement. Note: Can only be set when specified in the settings argument of
Required. No default.
- background : String
- Sets the background of the canvas to this value. It has to be a string, but accepts all CSS color values, gradients and images (special syntax, see the fill property of display objects). Note: Can only be set when specified in the settings argument of
- clearEachFrame : Boolean
- Specifies if the timeline module will clear the canvas before each frame or not.
- drawEachFrame : Boolean
- Specifies if the timeline module will draw the canvas after each frame or not.
- fps : Number
- The number of frames per second the timeline and animate modules will run at.
- plugins : Array
- Sets which plugins should be used on this core instance. The array contains the plugin names. Note: Can only be set when specified in the settings argument of
- disableScrolling : Boolean
- Disables scrolling on touch devices. It only disables it on the canvas element, the rest of the page is scrollable. Note: Can only be set when specified in the settings argument of
- width : Number
- The width of the canvas in pixels. Setting this property resizes the canvas and redraws everything.