SetRotation
Sets the rotation angle to the current drawing object.
Syntax
expression.SetRotation(rotAngle);
expression - A variable that represents a ApiDrawing class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| rotAngle | Required | number | New drawing rotation angle. |
Returns
boolean
Example
How to rotate a drawing object of the page.
- Code
- Result
// Rotate an object from a page.
const doc = Api.GetDocument();
const page = doc.GetPage(0);
const fill = Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61));
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape("rect", 65 * 36000, 10 * 36000, fill, stroke);
shape.SetPosition(100000, 2500000);
shape.SetRotation(90);
const rotAngle = shape.GetRotation();
const docContent = shape.GetContent();
const paragraph = docContent.GetElement(0);
paragraph.AddText("Drawing rotation angle is set to: " + rotAngle + " degrees");
page.AddObject(shape);