move()

Move the object.

Syntax move(x, y)

Return Type displayObject

Description

Move the object the specified lengths.

Arguments

x : Number
The length that the object will be moved in horizontal direction.
y : Number
The length that the object will be moved in vertical direction.

Return Value

displayObject. Returns the display object itself.

Examples

Example 1

We create a new core instance and a rectangle that we add to the canvas. Then we add an event handler that moves the rectangle when clicked.

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

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

canvas.addChild(rectangle);

rectangle.bind("click tap", function () {
	this.move(20, 20);
	canvas.redraw();
});
Output