SetRotation
Sets the rotation angle to the current drawing object.
Syntax
expression.SetRotation(nRotAngle);
expression
- A variable that represents a ApiDrawing class.
Parameters
Name | Required/Optional | Data type | Default | Description |
---|---|---|---|---|
nRotAngle | Required | number | New drawing rotation angle. |
Returns
boolean
Example
This example shows how to set the rotation angle to the drawing.
- Code
- Result
const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
slide.RemoveAllObjects();
const fill = Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61));
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape("rect", 130 * 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");
slide.AddObject(shape);