Background

oCanvas has a special module for the canvas background. To set a background you don't have to create any display object or anything, you just set the background property of the settings object in oCanvas.create() to whatever you want. If you want to change the background after that function call, you need to access the background module and call the set() method. The background can be set to any value that the fill property of display objects accepts, meaning any CSS color, gradient or image pattern.

Methods

Properties

bg : String or CanvasGradient or CanvasPattern
The background value compatible with the native fillStyle property of a canvas context. If it is a color value it is a string, otherwise CanvasGradient or CanvasPattern.
type : String
The type of background value. It is one of the following values:
  • transparent
  • color
  • gradient
  • image
value : String
The string background value, that was passed in to the set() method, or set through the settings object in oCanvas.create().