Skip to content

Shadow

Defined in: src/Shadow.ts:63

Constructors

new Shadow()

new Shadow(options?): Shadow

Defined in: src/Shadow.ts:124

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

new Shadow()

new Shadow(svgAttribute): Shadow

Defined in: src/Shadow.ts:125

Parameters

svgAttribute

string

Returns

Shadow

Properties

affectStroke

affectStroke: boolean

Defined in: src/Shadow.ts:96

Whether the shadow should affect stroke operations

Default


blur

blur: number

Defined in: src/Shadow.ts:75

Shadow blur


color

color: string

Defined in: src/Shadow.ts:69

Shadow color

Default


id

id: number

Defined in: src/Shadow.ts:114


includeDefaultValues

includeDefaultValues: boolean

Defined in: src/Shadow.ts:103

Indicates whether toObject should include default values

Default


nonScaling

nonScaling: boolean

Defined in: src/Shadow.ts:112

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


offsetX

offsetX: number

Defined in: src/Shadow.ts:82

Shadow horizontal offset

Default


offsetY

offsetY: number

Defined in: src/Shadow.ts:89

Shadow vertical offset

Default


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>

Defined in: src/Shadow.ts:221

Returns object representation of a shadow

Returns

Partial<SerializedShadowOptions>

Object representation of a shadow instance


toString()

toString(): string

Defined in: src/Shadow.ts:157

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


toSVG()

toSVG(object): string

Defined in: src/Shadow.ts:166

Returns SVG representation of a shadow

Parameters

object

FabricObject

Returns

string

SVG representation of a shadow


fromObject()

static fromObject(options): Promise<Shadow>

Defined in: src/Shadow.ts:237

Parameters

options

Partial<TClassProperties<Shadow>>

Returns

Promise<Shadow>


parseShadow()

static parseShadow(value): object

Defined in: src/Shadow.ts:137

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