SetShadow
Sets the shadow to the current graphic object.
Inherited from ApiDrawing.SetShadow.
Syntax
expression.SetShadow(shadow);
expression - A variable that represents an ApiImage class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| shadow | Required | ApiShadow | null | undefined | The shadow to apply, or null to remove the current shadow. |
Returns
boolean
Example
Apply an outer shadow to a drawing in a presentation.
// Give a shape a soft offset shadow so it appears lifted off the slide.
// Create a shape, build a shadow, and set it on the drawing with SetShadow.
const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
slide.RemoveAllObjects();
const fill = Api.CreateSolidFill(Api.RGB(255, 213, 191));
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape("rect", 120 * 36000, 60 * 36000, fill, stroke);
shape.SetPosition(40 * 36000, 40 * 36000);
slide.AddObject(shape);
shape.SetShadow(Api.CreateShadow({ color: Api.RGB(64, 64, 64), transparency: 0.3, offsetX: 4, offsetY: 4 }));