start()

Start the timeline.

Syntax start()

Return Type Timeline

Description

Start the timeline which will run the function specified by setLoop().

Return Value

Timeline. Returns the timeline object itself.

Examples

Example 1

We create a new core instance and a rectangle that we add to the canvas. Then we set the loop function which will increase the rotation of the rectangle by 1 degree. Finally we start the timeline. The setLoop() method returns the timeline object, so we could have appended the start() call after the setLoop() call instead if we wanted.

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

var rectangle = canvas.display.rectangle({
	x: 177,
	y: 190,
	origin: { x: "center", y: "center" },
	width: 200,
	height: 100,
	fill: "#000"
});

canvas.addChild(rectangle);

canvas.setLoop(function () {
	rectangle.rotation++;
});

canvas.timeline.start();
Output