rotate()
Rotate the object.
Description
Rotate the object the number of degrees specified.
Arguments
- angle : Number
- The number of degrees the object will be rotated. Positive value is clockwise. Negative value is counterclockwise.
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 rotates the rectangle when clicked.
View Example
Code
var canvas = oCanvas.create({
canvas: "#canvas",
background: "#ccc"
});
var rectangle = canvas.display.rectangle({
x: 177,
y: 180,
origin: { x: "center", y: "center" },
width: 200,
height: 100,
fill: "#000"
});
canvas.addChild(rectangle);
rectangle.bind("click tap", function () {
this.rotate(45);
canvas.redraw();
});
Output