Icon

Icon

new Icon(pIconDataopt)

Creates this icon instance.
Source:
Parameters:
Name Type Attributes Description
pIconData Array <optional>
The icon data that is used to build this icon.

Classes

Icon

Methods

addFrame(pFrameData) → {Frame|undefined}

Adds a new frame to this icon.
Source:
Parameters:
Name Type Description
pFrameData Frame | Array The frame data to give this frame.
Returns:
Type:
Frame | undefined
The frame that was added or undefined.

addState(pIconData) → {Icon|undefined}

Adds this icon data as a state. A state is also an icon.
Source:
Parameters:
Name Type Description
pIconData Array The data used to create this state icon.
Returns:
Type:
Icon | undefined
The state that was added or undefined.

export() → {Array}

Exports this icon's data into proper vyi format.
Source:
Returns:
Type:
Array
An array of data related to this icon in the proper vyi format.

getDataURL() → {DataURL}

Gets the data URL of this icon.
Source:
Returns:
Type:
DataURL
- The base64 data of this image.

getDelay() → {number}

Gets the delay of this icon.
Source:
Returns:
Type:
number
The delay of this icon.

getFrame(pIndex) → {Frame|undefined}

Gets the frame existing at pIndex. Frame 0 will actually be frame "1" in the animation. As this icon will actually be frame 0. If you are trying to get "frame" 1. Then you will need to use the icon's delay and data url. As that is frame 0.
Source:
Parameters:
Name Type Description
pIndex number The index of the frame to get.
Returns:
Type:
Frame | undefined
The frame found at pIndex.

getFrameCount() → {number}

Gets the number of frames this icon has.
Source:
Returns:
Type:
number
The amount of frames this icon has.

getFrames() → {Array}

Returns an array of all the frames this icons has.
Source:
Returns:
Type:
Array
An array of frames this icon has.

getHeight() → {number}

Gets the height of the icon.
Source:
Returns:
Type:
number
The height of the icon.

getId() → {string}

Gets the id of this icon.
Source:
Returns:
Type:
string
The id of this icon.

getName() → {string}

Returns the name of this icon.
Source:
Returns:
Type:
string
The name of this icon.

getParent() → {Icon|undefined}

Gets the icon this state belongs to. If this icon is not a state, it will return undefined.
Source:
Returns:
Type:
Icon | undefined
The icon this state belongs to.

getSize() → {Object}

Gets the width and height of this icon and returns it.
Source:
Returns:
Type:
Object
An object with the width and height of this icon.

getState(pName) → {Icon}

Gets the state that has the name pName. The LAST defined state that has the passed name will be returned.
Source:
Parameters:
Name Type Description
pName string The name of the state to get.
Returns:
Type:
Icon
The state that has the name of pName.

getStateCount() → {number}

Gets the number of states this icon has.
Source:
Returns:
Type:
number
The amount of states this icon has.

getStateNames() → {Array.<string>}

Returns an array of all the state names this icon has.
Source:
Returns:
Type:
Array.<string>
An array of the state names.

getStates() → {Array.<Icon>}

Returns an array of all the states this icon has.
Source:
Returns:
Type:
Array.<Icon>
An array of states this icon has.

getVyi() → {VYI}

Gets the vyi this icon belongs to.
Source:
Returns:
Type:
VYI
The vyi this icon belongs to.

getWidth() → {number}

Gets the width of the icon.
Source:
Returns:
Type:
number
The width of the icon.

parse(pIconData)

Parses through the icon data and adds data to this icon.
Source:
Parameters:
Name Type Description
pIconData Array The icon data that is used to build this icon.

removeFrame(pFrame) → {self}

Removes the frame passed.
Source:
Parameters:
Name Type Description
pFrame Frame The frame to remove from this icon.
Returns:
Type:
self
This icon instance.

removeFrameByIndex(pIndex) → {self}

Removes the frame via it's index.
Source:
Parameters:
Name Type Description
pIndex number The index of the frame to remove.
Returns:
Type:
self
This icon instance.

removeState(pState) → {self}

Removes the state passed.
Source:
Parameters:
Name Type Description
pState Icon The state to remove from this icon.
Returns:
Type:
self
This icon instance.

removeStateById(pName) → {self}

Removes the state via it's id.
Source:
Parameters:
Name Type Description
pName string The id to use to find the state.
Returns:
Type:
self
This icon instance.

removeStateByName(pName) → {self}

Removes the state via it's name. The LAST defined icon that has the passed name will be removed. As names are not unique.
Source:
Parameters:
Name Type Description
pName string The name to use to find the state.
Returns:
Type:
self
This icon instance.

rename(pName) → {self}

Changes the name of this icon.
Source:
Parameters:
Name Type Description
pName string The new name of the icon.
Returns:
Type:
self
This icon instance.

reorderFrame(pCurrentIndex, pIndex) → {self}

Reorders the frame in the animation. The index of the passed frame will be swapped with the frame at pIndex. The "first" frame of the animation is technically this icon's dataURL. So if you are aiming to change the order of this icon and convert it into a frame. pCurrentIndex must be set to -1 to match this icon.
Source:
Parameters:
Name Type Description
pCurrentIndex number The current index of the frame.
pIndex number The index the frame will be moving to.
Returns:
Type:
self
This icon instance.

setAllFrameDelays(pDelay) → {self}

Sets all the frames belonging to this icon to the same delay.
Source:
Parameters:
Name Type Description
pDelay number The delay to set all frames to.
Returns:
Type:
self
This icon instance.

setDataURL(pDataURL) → {self}

Sets the data url of this icon.
Source:
Parameters:
Name Type Description
pDataURL DataURL The base64 data of this image.
Returns:
Type:
self
This icon instance.

setDelay(pDelay) → {self}

Sets the frame delay of this icon.
Source:
Parameters:
Name Type Description
pDelay number The delay to set this frame to.
Returns:
Type:
self
This icon instance.

setSize(pWidth, pHeight) → {self}

Sets the size of this icon.
Source:
Parameters:
Name Type Description
pWidth number The width of this icon.
pHeight number THe height of this icon.
Returns:
Type:
self
This icon instance.