load()

Load the scene instance.

Syntax load()

Return Type Scene

Description

Load the scene instance. This will add all objects that have been added to the scene to the canvas.

Return Value

Scene. Returns the scene instance itself.

Examples

Example 1

We create a core instance and a text object, but we don't add it to the canvas. Then we create a new scene called menu. We pass a function as the init argument. Inside of that we add our text object to the scene. We store the returned object in a variable. Then finally we load our scene, and our text object is added to canvas.

View Example
Code
var canvas = oCanvas.create({
	canvas: "#canvas",
	background: "#ccc"
});

var startGame = canvas.display.text({
	x: 177,
	y: 170,
	origin: { x: "center", y: "top" },
	align: "center",
	font: "bold 30px sans-serif",
	text: "Start Game!",
	fill: "#000"
});

var menu = canvas.scenes.create("menu", function () {
	this.add(startGame);
});

menu.load();
Output