HTML canvas shadowOffSetX Property
Example
// Accessing the element
let c = document.getElementById("myCanvas");
// Styling canvas
let ctx = c.getContext("2d");
ctx.shadowBlur = 10;
ctx.shadowOffsetX = 10;
ctx.shadowColor = "black";
ctx.fillStyle = "red";
ctx.fillRect(25, 25, 100, 100);
Meaning
The shadowOffSetX canvas property sets or returns the horizontal distance of the shadow from the shape.
Standard Syntax
Default value:
0
JavaScript syntax:
context.shadowOffSetX=number;
Advertisement
Property Values
| Value | Description |
|---|---|
| number | Specifies a positive or negative number that defines the horizontal distance of the shadow from the shape. |