Skip to content

SprayBrush

See

demo

Extends

Constructors

new SprayBrush()

new SprayBrush(canvas): SprayBrush

Constructor

Parameters

canvas: Canvas

Returns

SprayBrush

Instance of a spray brush

Overrides

BaseBrush.constructor

Defined in

src/brushes/SprayBrush.ts:83

Properties

canvas

canvas: Canvas

Todo

add type

Inherited from

BaseBrush.canvas

Defined in

src/brushes/BaseBrush.ts:73


color

color: string = 'rgb(0, 0, 0)'

Color of a brush

Default

Inherited from

BaseBrush.color

Defined in

src/brushes/BaseBrush.ts:16


density

density: number = 20

Density of a spray (number of dots per chunk)

Default

Defined in

src/brushes/SprayBrush.ts:44


dotWidth

dotWidth: number = 1

Width of spray dots

Default

Defined in

src/brushes/SprayBrush.ts:51


dotWidthVariance

dotWidthVariance: number = 1

Width variance of spray dots

Default

Defined in

src/brushes/SprayBrush.ts:58


limitedToCanvasSize

limitedToCanvasSize: boolean = false

When true, the free drawing is limited to the whiteboard size. Default to false.

Default

false

Inherited from

BaseBrush.limitedToCanvasSize

Defined in

src/brushes/BaseBrush.ts:68


optimizeOverlapping

optimizeOverlapping: boolean = true

Whether overlapping dots (rectangles) should be removed (for performance reasons)

Default

Defined in

src/brushes/SprayBrush.ts:72


randomOpacity

randomOpacity: boolean = false

Whether opacity of a dot should be random

Default

Defined in

src/brushes/SprayBrush.ts:65


shadow

shadow: null | Shadow = null

Shadow object representing shadow of this shape. Backwards incompatibility note: This property replaces “shadowColor” (String), “shadowOffsetX” (Number), “shadowOffsetY” (Number) and “shadowBlur” (Number) since v1.2.12

Default

Inherited from

BaseBrush.shadow

Defined in

src/brushes/BaseBrush.ts:32


strokeDashArray

strokeDashArray: null | number[] = null

Stroke Dash Array.

Default

Inherited from

BaseBrush.strokeDashArray

Defined in

src/brushes/BaseBrush.ts:60


strokeLineCap

strokeLineCap: CanvasLineCap = 'round'

Line endings style of a brush (one of “butt”, “round”, “square”)

Default

Inherited from

BaseBrush.strokeLineCap

Defined in

src/brushes/BaseBrush.ts:39


strokeLineJoin

strokeLineJoin: CanvasLineJoin = 'round'

Corner style of a brush (one of “bevel”, “round”, “miter”)

Default

Inherited from

BaseBrush.strokeLineJoin

Defined in

src/brushes/BaseBrush.ts:46


strokeMiterLimit

strokeMiterLimit: number = 10

Maximum miter length (used for strokeLineJoin = “miter”) of a brush’s

Default

Inherited from

BaseBrush.strokeMiterLimit

Defined in

src/brushes/BaseBrush.ts:53


width

width: number = 10

Width of a spray

Default

Overrides

BaseBrush.width

Defined in

src/brushes/SprayBrush.ts:37

Methods

_render()

_render(): void

Render all spray chunks

Returns

void

Overrides

BaseBrush._render

Defined in

src/brushes/SprayBrush.ts:177


addSprayChunk()

addSprayChunk(pointer): void

Parameters

pointer: Point

Returns

void

Defined in

src/brushes/SprayBrush.ts:192


onMouseDown()

onMouseDown(pointer): void

Invoked on mouse down

Parameters

pointer: Point

Returns

void

Overrides

BaseBrush.onMouseDown

Defined in

src/brushes/SprayBrush.ts:93


onMouseMove()

onMouseMove(pointer): void

Invoked on mouse move

Parameters

pointer: Point

Returns

void

Overrides

BaseBrush.onMouseMove

Defined in

src/brushes/SprayBrush.ts:106


onMouseUp()

onMouseUp(): void

Invoked on mouse up

Returns

void

Overrides

BaseBrush.onMouseUp

Defined in

src/brushes/SprayBrush.ts:117


renderChunck()

renderChunck(sprayChunck): void

Parameters

sprayChunck: SprayBrushPoint[]

Returns

void

Defined in

src/brushes/SprayBrush.ts:159