Skip to content

Shadow

Constructors

new Shadow()

new Shadow(options?): Shadow

Parameters

options?: Partial<TClassProperties<Shadow>>

Options object with any of color, blur, offsetX, offsetY properties or string (e.g. “rgba(0,0,0,0.2) 2px 2px 10px”)

Returns

Shadow

See

demo

Defined in

src/Shadow.ts:124

new Shadow()

new Shadow(svgAttribute): Shadow

Parameters

svgAttribute: string

Returns

Shadow

Defined in

src/Shadow.ts:125

Properties

affectStroke

affectStroke: boolean

Whether the shadow should affect stroke operations

Default

Defined in

src/Shadow.ts:96


blur

blur: number

Shadow blur

Defined in

src/Shadow.ts:75


color

color: string

Shadow color

Default

Defined in

src/Shadow.ts:69


id

id: number

Defined in

src/Shadow.ts:114


includeDefaultValues

includeDefaultValues: boolean

Indicates whether toObject should include default values

Default

Defined in

src/Shadow.ts:103


nonScaling

nonScaling: boolean

When false, the shadow will scale with the object. When true, the shadow’s offsetX, offsetY, and blur will not be affected by the object’s scale. default to false

Default

Defined in

src/Shadow.ts:112


offsetX

offsetX: number

Shadow horizontal offset

Default

Defined in

src/Shadow.ts:82


offsetY

offsetY: number

Shadow vertical offset

Default

Defined in

src/Shadow.ts:89


ownDefaults

static ownDefaults: Partial<TClassProperties<Shadow>> = shadowDefaultValues

Defined in

src/Shadow.ts:116


type

static type: string = 'shadow'

Defined in

src/Shadow.ts:118

Methods

toObject()

toObject(): Partial<SerializedShadowOptions>

Returns object representation of a shadow

Returns

Partial<SerializedShadowOptions>

Object representation of a shadow instance

Defined in

src/Shadow.ts:221


toSVG()

toSVG(object): string

Returns SVG representation of a shadow

Parameters

object: FabricObject<Partial<FabricObjectProps>, SerializedObjectProps, ObjectEvents>

Returns

string

SVG representation of a shadow

Defined in

src/Shadow.ts:166


toString()

toString(): string

Returns a string representation of an instance

Returns

string

Returns CSS3 text-shadow declaration

See

http://www.w3.org/TR/css-text-decor-3/#text-shadow

Defined in

src/Shadow.ts:157


fromObject()

static fromObject(options): Promise<Shadow>

Parameters

options: Partial<TClassProperties<Shadow>>

Returns

Promise<Shadow>

Defined in

src/Shadow.ts:237


parseShadow()

static parseShadow(value): object

Parameters

value: string

Shadow value to parse

Returns

object

Shadow object with color, offsetX, offsetY and blur

blur

blur: number

color

color: string

offsetX

offsetX: number

offsetY

offsetY: number

Defined in

src/Shadow.ts:137