new $.oAttribute(oNodeObject, attributeObject, parentAttribute)
openHarmony/openHarmony_attribute.js, line 84
The constructor for the $.oAttribute class.
Name | Type | Description |
---|---|---|
oNodeObject |
$.oNode | The oNodeObject that the attribute is associated to. |
attributeObject |
attr | The internal harmony Attribute Object. |
parentAttribute |
$.oAttribute | The parent attribute of the subattribute. |
Properties:
Name | Type | Description |
---|---|---|
node |
$.oNode | The oNode this attribute belongs to. |
attributeObject |
attr | The internal harmony Attribute Object. |
keyword |
string | The keyword describing this attribute. (always in lower case) |
shortKeyword |
string | The full keyword describing this attribute, including parent attributes separated with a "." (always in lower case) |
parentAttribute |
$.oAttribute | The parent oAttribute object |
subAttributes |
Array.<$.oAttribute> | The subattributes of this attribute. |
Example
// oAttribute objects can be grabbed from the node .attributes object with dot notation, by calling the attribute keyword in lowercase.
var myNode = $.scn.getSelectedNodes()[0]; // grab the first selected node
var Xattribute = myNode.attributes.position.x; // gets the position.x attribute of the node if it has it (for example, PEG nodes have it)
var Xcolumn = Xattribute.column; // retrieve the linked column to the element (The object that holds the animation)
Xattribute.setValue(5, 5); // sets the value to 5 at frame 5
// attribute values can also be set directly on the node when not animated:
myNode.position.x = 5;
Members
-
column$.oColumn
-
The column attached to the attribute.
Example
// link a new column to an attribute by setting this value: var myColumn = $.scn.addColumn("BEZIER"); myNode.attributes.position.x.column = myColumn; // values contained in "myColumn" now define the animation of our peg's x position // to automatically create a column and link it to the attribute, use: myNode.attributes.position.x.addColumn(); // if the column exist already, it will just be returned. // to unlink a column, just set it to null/undefined: myNode.attributes.position.x.column = null; // values are no longer animated.
-
defaultValuebool
-
Returns the default value of the attribute for most keywords
- TODO
-
- switch the implentation to types?
Example
// to reset an attribute to its default value: // (mostly used for position/angle/skew parameters of pegs and drawing nodes) var myAttribute = $.scn.nodes[0].attributes.position.x; myAttribute.setValue(myAttribute.defaultValue);
-
framesArray.<$.oFrame>
-
The frames array holding the values of the animation. Starts at 1, as array indexes correspond to frame numbers.
-
keyframesArray.<$.oFrame>
-
An array of only the keyframes (frames with a set value) of the animation.
-
keywordstring
-
The full keyword of the attribute.
-
namestring
-
The display name of the attribute
-
shortKeywordstring
-
The part of the attribute's keyword that is after the "." for subAttributes.
-
typestring
-
The type of the attribute.
Methods
-
addColumn(){$.oColumn}
openHarmony/openHarmony_attribute.js, line 671 -
Adds a column with a default name, based on the attribute type. If a column already exists, it returns it.
Returns:
Type Description $.oColumn the created column -
getKeyframes(){Array.<$.oFrame>}
openHarmony/openHarmony_attribute.js, line 412 -
Provides the keyframes of the attribute.
Returns:
Type Description Array.<$.oFrame> The filtered keyframes. -
getKeyFrames(){Array.<$.oFrame>}
openHarmony/openHarmony_attribute.js, line 424 -
Provides the keyframes of the attribute.
- Deprecated
- For case consistency, keyframe will never have a capital F
Returns:
Type Description Array.<$.oFrame> The filtered keyframes. -
getLinkedColumns(){Array.<$.oColumn>}
openHarmony/openHarmony_attribute.js, line 436 -
Recursively get all the columns linked to the attribute and its subattributes
Returns:
Type Description Array.<$.oColumn> the list of columns linked to the subattributes -
getValue(frame){object}
openHarmony/openHarmony_attribute.js, line 484 -
Gets the value of the attribute at the given frame.
Name Type Description frame
int The frame at which to set the value, if not set, assumes 1 Returns:
Type Description object The value of the attribute in the native format of that attribute (contextual to the attribute). -
setValue(value, frame)
openHarmony/openHarmony_attribute.js, line 587 -
Sets the value of the attribute at the given frame.
Name Type Default Description value
string The value to set on the attribute. frame
int 1 optional The frame at which to set the value, if not set, assumes 1 -
value(frame){object}
openHarmony/openHarmony_attribute.js, line 725 -
Gets the value of the attribute at the given frame.
Name Type Description frame
int The frame at which to set the value, if not set, assumes 1 - Deprecated
- use oAttribute.getValue(frame) instead (see: function names as verbs)
Returns:
Type Description object The value of the attribute in the native format of that attribute (contextual to the attribute).