Skip to main content

Class: BrushPrototype

Rendering.2D.BrushPrototype(shape, sizeopt)

Strokes drawn with this brush will be drawn using polygon as a shape

Constructor

new BrushPrototype(shape, sizeopt)

Parameters:
NameTypeAttributesDefaultDescription
shapePolygon|PathBuilding.Polygon|URI|Rendering.2D.Brush2D.ShapeDescriptorPolygon shape, required for non particles strokes.Polygon shape shoud be centered in rect with left: -0.5, top: -0.5, right: 0.5, bottom: 0.5.
sizefloat<optional>1Min stroke size applier. Multiple shapes for Brush2D requires different sizes which defines ranges.
Properties:
NameTypeDescription
shapePathBuilding.Polygon
encodingSerialization.TypedArrayCodec.EncodingApplicable for JSON serialization, configures shape serialization type

Since:

  • 3.0

Methods

toJSON() → {JSON}

Serialize to JSON

Returns:

BrushPrototype data

Type

JSON

(static) create(type, size, …shapeArgs) → Rendering.2D.BrushPrototype

BrushPrototype factory, based on shape description

Parameters:
NameTypeAttributesDefaultDescription
typeBrushPrototype.Type
sizefloat0Applicable for mipmap functionality, should be 0 when mipmap is not available
shapeArgsVarArgs.<float><repeatable>ShapeFactory class factory method arguments
Returns:

BrushPrototype instance

Type

Rendering.2D.BrushPrototype

(static) fromJSON(data) → Rendering.2D.BrushPrototype

Deserialize from JSON

Parameters:
NameTypeDescription
dataJSONBrushPrototype data
Returns:

BrushPrototype instance

Type

Rendering.2D.BrushPrototype

Home