API Docs for: 6.0.1
Show:

window.scrawl_Factories Class

window.scrawl

scrawlPathFactories extension adaptions to the scrawl-canvas library object

Methods

makeBezier

(
  • items
)

A factory function to generate bezier curve Shape or Path entity objects

The argument can include:

  • startX - Number or % String; default: 0
  • startY - Number or % String; default: 0
  • startControlX - Number or % String; default: 0 (not retained)
  • startControlY - Number or % String; default: 0 (not retained)
  • endControlX - Number or % String; default: 0 (not retained)
  • endControlY - Number or % String; default: 0 (not retained)
  • endX - Number or % String; default: 0 (not retained)
  • endY - Number or % String; default: 0 (not retained)
  • shape - Boolean, true to create Shape; false (default) to create Path
  • any other legitimate Entity, Context or Shape/Path attribute

Percentage String values are relative to the entity's cell's dimensions

Parameters:

  • items Object

    Object containing attributes

Returns:

Shape or Path entity object

makeEllipse

(
  • items
)

A factory function to generate elliptical Shape or Path entity objects

The argument can include:

  • radiusX - Number, horizontal radius of ellipse; default: 0 (not retained)
  • radiusY - Number, vertical radius of ellipse; default: 0 (not retained)
  • shape - Boolean, true to create Shape; false (default) to create Path (not retained)
  • any other legitimate Entity, Context or Shape/Path attribute

Percentage String values are relative to the entity's cell's dimensions

Parameters:

  • items Object

    Object containing attributes

Returns:

Shape or Path entity object

makeLine

(
  • items
)

A factory function to generate straight line Shape or Path entity objects

The argument can include:

  • startX - Number or % String; default: 0
  • startY - Number or % String; default: 0
  • endX - Number or % String; default: 0 (not retained)
  • endY - Number or % String; default: 0 (not retained)
  • shape - Boolean, true to create Shape; false (default) to create Path
  • any other legitimate Entity, Context or Shape/Path attribute

Percentage String values are relative to the entity's cell's dimensions

Parameters:

  • items Object

    Object containing attributes

Returns:

Shape or Path entity object

makeQuadratic

(
  • items
)

A factory function to generate quadratic curve Shape or Path entity objects

The argument can include:

  • startX - Number or % String; default: 0
  • startY - Number or % String; default: 0
  • controlX - Number or % String; default: 0 (not retained)
  • controlY - Number or % String; default: 0 (not retained)
  • endX - Number or % String; default: 0 (not retained)
  • endY - Number or % String; default: 0 (not retained)
  • shape - Boolean, true to create Shape; false (default) to create Path
  • any other legitimate Entity, Context or Shape/Path attribute

Percentage String values are relative to the entity's cell's dimensions

Parameters:

  • items Object

    Object containing attributes

Returns:

Shape or Path entity object

makeRectangle

(
  • items
)

A factory function to generate rectangular Shape or Path entity objects, with optional rounded corners

The argument can include:

  • width - Number or % String, default: 0
  • height - Number or % String, default: 0
  • also, 0, 1 or more of the following radius attributes (all Number, default: radius=0): radiusTopLeftX, radiusTopLeftY, radiusTopRightX, radiusTopRightY, radiusBottomRightX, radiusBottomRightY, radiusBottomLeftX, radiusBottomLeftY, radiusTopLeft, radiusTopRight, radiusBottomRight, radiusBottomLeft, radiusTopX, radiusTopY, radiusBottomX, radiusBottomY, radiusLeftX, radiusLeftY, radiusRightX, radiusRightY, radiusTop, radiusBottom, radiusRight, radiusLeft, radiusX, radiusY, radius (not retained)
  • shape - Boolean, true to create Shape; false (default) to create Path (not retained)
  • any other legitimate Entity, Context or Shape/Path attribute

Percentage String values are relative to the entity's cell's dimensions

Parameters:

  • items Object

    Object containing attributes

Returns:

Shape or Path entity object

makeRegularShape

(
  • items
)

A factory function to generate regular entitys such as triangles, stars, hexagons, etc

The argument can include:

  • angle - Number; eg an angle of 72 produces a pentagon, while 144 produces a five-pointed star - default: 0
  • sides - Number; number of sides to the regular entity - default: 0
  • outline - Number; default: 0
  • radius - Number; default: 0 (not retained)
  • startControlX - Number or % String - x coordinate for control (quadratic) or startControl (bezier) curve; default: 0 (not retained)
  • controlX - alias for startControlX; default: 0 (not retained)
  • startControlY - Number or % String - y coordinate for control (quadratic) or startControl (bezier) curve; default: 0 (not retained)
  • controlY - alias for startControlY; default: 0 (not retained)
  • endControlX - Number or % String - x coordinate for endControl (bezier) curve; default: 0 (not retained)
  • endControlY - Number or % String - y coordinate for endControl (bezier) curve; default: 0 (not retained)
  • lineType - String defining type of line/curve to use for generated entity (not retained)
  • shape - Boolean, true to create Shape; false (default) to create Path (not retained)
  • any other legitimate Entity, Context or Shape/Path attribute

Entitys can be generated using lines, or quadratic or bezier curves. The species of line to use is defined in the lineType attribute which accepts the following values:

  • 'l' - straight line (default)
  • 'q' - quadratic curve
  • 't' - reflected quadratic curve
  • 'c' - bezier curve
  • 's' - reflected bezier curve

Either the 'angle' attribute or the 'sides' attribute (but not both) must be included in the argument object

Percentage String values are relative to the entity's cell's dimensions

Parameters:

  • items Object

    Object containing attributes

Returns:

Shape or Path entity object