Two.Anchor

Extends: Two.Vector

An object that holds 3 Two.Vectors, the anchor point and its corresponding handles: left and right. In order to properly describe the bezier curve about the point there is also a command property to describe what type of drawing should occur when Two.js renders the anchors.

Constructor

ArgumentDescription
xThe x position of the root anchor point.
yThe y position of the root anchor point.
axThe x position of the left handle point.
ayThe y position of the left handle point.
bxThe x position of the right handle point.
byThe y position of the right handle point.
commandThe command to describe how to render. Applicable commands are Two.Commands

fromObject

Returns: Two.Anchor

ArgumentDescription
objObject notation of a Two.Anchor to create a new instance

Create a new Two.Anchor from an object notation of a Two.Anchor.

nota-bene

Works in conjunction with Two.Anchor.toObject

copy

ArgumentDescription
vThe anchor to apply values to.

Copy the properties of one Two.Anchor onto another.

clone

Returns: Two.Anchor

Create a new Two.Anchor, set all its values to the current instance and return it for use.

toObject

Returns: Object

  • An object with properties filled out to mirror Two.Anchor.

Create a JSON compatible plain object of the current instance. Intended for use with storing values in a database.

nota-bene

Works in conjunction with Two.Anchor.fromObject

toString

Returns: String

  • A String with comma-separated values reflecting the various values on the current instance.

Create a string form of the current instance. Intended for use with storing values in a database. This is lighter to store than the JSON compatible Two.Anchor.toObject.