Subcomposition Object¶
Properties¶
Name | Type | Description | Example |
---|---|---|---|
id | String | id of the subcomposition | "a4db02c8-df43-4737-a43d-ba9a4430cd86" |
name | String | name of the subcomposition | "Lower Title" |
Methods¶
The subcomposition object has following methods:
Method | Return type | Brief description |
---|---|---|
getControlNode() | object | Returns control nodes of the subcomposition |
getLogicLayer() | object | Returns logic layers of the subcomposition |
getModel() | object | Returns the model description of the subcomposition |
getPayload() | object | Returns the payload of the subcomposition |
getState() | object | Returns the state of the subcomposition |
getSubcompositionById( id ) | object | Returns the subcomposition object of the subcomposition with the specified id |
getSubcompositionByName( name ) | object | Returns the subcomposition object of the subcomposition with the specified name |
jumpTo( to ) | object | Jump to the animation state specified by to |
listSubcompositions() | object | Returns an array of subcompositions of the subcomposition |
playTo( to ) | object | Play to the animation state specified by to |
resetPayload() | object | Resets payload to default values. |
setPayload( payload ) | object | Set payload of the subcomposition |
getControlNode()¶
Returns control node model and payload of the composition
// The code below prints the list of controlnode description to the console
var controlnode = subCompObject.getControlNode();
console.log("controlnode =", controlnode);
Return
object
- JSON description, if the composition has control nodes
undefined
- if the composition has no control nodes
{
"id": "controlNode",
"model": {
"fields": {
"3c686562-1cf3-7493-7fae-803009afa22e": {
"defaultValue": "Default Text",
"id": "Top Title",
"index": 2,
"title": "Top Title",
"type": "text"
},
"502a7d0e-e0f8-a895-1b80-43cdb81a1ca9": {
"defaultValue": "Default Text",
"id": "Bottom Title",
"index": 3,
"title": "Bottom Title",
"type": "text"
}
}
},
"name": "Control Node",
"payload": {
"Bottom Title": "Extra Information",
"Top Title": "SINGULAR.LIVE"
},
"thumbnail": "/images/noimage.png"
}
getLogicLayer()¶
Returns logic layer details of the composition
// The code below prints the logic layer description to the console
var logicLayer = subCompObject.getLogicLayer();
console.log("logicLayer =", logicLayer);
Return
object
- JSON description, if a logic layer is defined for the composition
undefined
- if no logic layer is defined for the composition
{
"name": "Lower",
"tag": "#B0C8CD"
}
getModel()¶
Returns the model description of control node fields of the composition
// The code below prints the list of controlnode description to the console
var cnModel = subCompObject.getModel();
console.log("cnModel =", cnModel);
Return
object
- Array of JSON objects, if the composition has control nodes
undefined
- if the composition has no control nodes
[
{
"0": {
"defaultValue": "Default Text",
"id": "Top Title",
"index": 2,
"title": "Top Title",
"type": "text"
}
},
{
"1": {
"defaultValue": "Default Text",
"id": "Bottom Title",
"index": 3,
"title": "Bottom Title",
"type": "text"
}
}
]
getPayload()¶
Returns the payload of to control node of the composition
// The code below prints the list of controlnode payload to the console
var cnPayload = subCompObject.getPayload();
console.log("cnPayload =", cnPayload);
Return
object
- Array of JSON objects, if the composition has control nodes
undefined
- if the composition has no control nodes
[
{
"0": {
"key": "Bottom Title",
"value": "Extra Information"
}
},
{
"1": {
"key": "Top Title",
"value": "SINGULAR.LIVE"
}
}
]
getState()¶
Returns the animation state of the composition
// The code below prints the animation to the console
var animState = subCompObject.getState();
console.log("animState =", animState);
Return
String
- animation state
getState = Out
getSubcompositionById( id )¶
Returns the subcomposition object of the subcomposition with the specified id
Parameters
Name | Type | Description |
---|---|---|
id | String | Id of the subcomposition |
// The code below prints the subcomposition object to the console
var subCompId = "a4db02c8-df43-4737-a43d-ba9a4430cd86";
var subCompObject = compositionObject.getSubcompositionById(subCompId);
console.log("subCompObject =", subCompObject);
Return
object
- Subcomposition object
subcompositionObject:
> getControlNode: ƒ subcomp_getControlNode()
> getLogicLayer: ƒ subcomp_getLogicLayer()
> getModel: ƒ subcomp_getModel()
> getPayload: ƒ subcomp_getPayload()
> getState: ƒ subcomp_getState()
> getSubcompositionById: ƒ subcomp_getSubcompositionById(id)
> getSubcompositionByName: ƒ subcomp_getSubcompositionByName(name)
> id: "a4db02c8-df43-4737-a43d-ba9a4430cd86"
> jumpTo: ƒ jumpTo(to)
> listSubcompositions: ƒ subcomp_listSubcompositions()
> name: "Lower Title"
> playTo: ƒ playTo(to)
> resetPayload: ƒ subcomp_resetPayload()
> setPayload: ƒ subcomp_setPayload(payload)
See also
getSubcompositionByName( name )¶
Returns the subcomposition object of the subcomposition with the specified name
Parameters
Name | Type | Description |
---|---|---|
id | String | Id of the subcomposition |
// The code below prints the subcomposition object to the console
var subCompName = "Lower Title";
var subCompObject = compositionObject.getSubcompositionByName(subCompName);
console.log("subCompObject =", subCompObject);
Return
object
- Subcomposition object
subcompositionObject:
> getControlNode: ƒ subcomp_getControlNode()
> getLogicLayer: ƒ subcomp_getLogicLayer()
> getModel: ƒ subcomp_getModel()
> getPayload: ƒ subcomp_getPayload()
> getState: ƒ subcomp_getState()
> getSubcompositionById: ƒ subcomp_getSubcompositionById(id)
> getSubcompositionByName: ƒ subcomp_getSubcompositionByName(name)
> id: "a4db02c8-df43-4737-a43d-ba9a4430cd86"
> jumpTo: ƒ jumpTo(to)
> listSubcompositions: ƒ subcomp_listSubcompositions()
> name: "Lower Title"
> playTo: ƒ playTo(to)
> resetPayload: ƒ subcomp_resetPayload()
> setPayload: ƒ subcomp_setPayload(payload)
See also
jumpTo( to )¶
Jump to the animation state specified by to
// The code below sets the animation state to "In"
subCompObject.jumpTo("In");
Return
none
listSubcompositions()¶
Returns an array of subcompositions of the composition
// The code below prints the list of subcompositions to the console
var subcompositionList = subCompObject.listSubcompositions();
console.log("subcompositionList =", subcompositionList);
Return
object
- Array of JSON objects
[ "0" { "id": "a4db02c8-df43-4737-a43d-ba9a4430cd86", "name": "Lower 1 Line - Large" } ]
playTo( to )¶
Play to the animation state specified by to
// The code below plays the animation state to "In"
subCompObject.playTo("In");
Return
none
resetPayload()¶
Reset payload of the composition to default values.
// The code below reset payloads of the composition
subCompObject.resetPayload();
Return
none
setPayload( payload )¶
Set payload of the control nodes of a composition
// The code below sets payloads of the composition
var payload = {
"Bottom Title": "Extra Information",
"Top Title": "SINGULAR.LIVE",
};
subCompObject.setPayload(payload);
Return
none