The Sequence Instance Struct
A sequence, when placed in a room, is placed as an element on the layer, and this element contains a sequence instance. This sequence instance will have the following properties in its struct:
- sequence: This is the ID of the sequence object struct that the sequence instance has been created from (see herefor more details). You can get or set this struct, and so change the base
sequence that the instance is referencing.
- headPosition: This is the current playhead position (in frames) for the sequence instance. You can get or set this value, but note that setting it to a value greater or less than
the currently defined play region will have different effects depending on the type of playback set for the sequence. See layer_sequence_headpos() for more information.
- headDirection: This is the current playback direction for the sequence instance. You can get or set this value using the following constants (Note that you can use the layer functions layer_sequence_get_headdir() and
layer_sequence_headdir() to get or set this value without having to access the struct directly):
| Constant |
Description |
Value |
| seqdir_right |
The sequence will play frames in an incremental order from left to right |
1 |
| seqdir_left |
The sequence will play frames in a decremental order from right to left |
-1 |
- speedScale: This property can be used to get or set the playback speed scale. The speed scale is a multiplier, where 1 is the default playback speed and values less than 1 will slow the playback and values larger than 1 will speed
it up, eg: a value of 0.5 would be half playback speed, while a value of 2 would be double playback speed. Note that you can use the layer functions layer_sequence_get_speedscale() and
layer_sequence_speedscale() to get or set this value without having to access the struct directly.
- paused: You can check this property to see if a sequence has been paused or not, and it will be true if it has, or false otherwise. This is a read-only property, but you can use the layer function layer_sequence_pause() to
pause playback, and layer_sequence_play() to resume it again if required. You can also check this property using the layer function layer_sequence_is_paused() rather
than check the property in the struct directly.
- finished: You can check this property to see if a sequence has finished playing or not, returning true if it is finished playing, and false otherwise. This is a read-only property, and will only ever return true for tracks that are not set to loop or ping-pong. You can also check this property using the layer function layer_sequence_is_finished() rather than check the property
in the struct directly.
- elementID: This property holds the ID of the sequence element. This iD is a simple identifying value that is associated with a layer in the room editor, and it can then be used with the appropriate layer functions to
find the layer the sequence has been assigned to or to change certain sequence properties without having to deal with the struct.
- activeTracks: This property will hold an array of "evaluation" structs containing information on the current state of each asset track in the sequence (graphics, sequence, audio etc...). These are only the top-level tracks,
and the array returned is read-only. For the contents of the asset track struct returned in each array entry, please see the section below.
The following list contains the properties that may be available to you when accessing a track struct (as returned by the activeTracks property of the parent sequence struct, explained above). Each asset track struct may have some or all of
the following properties, depending on the type of asset the track is referencing (note that you can get or set all these properties, except where specified as read-only), and all values returned are the for the current playhead position:
- matrix: This is the transformation matrix used to draw the track (sprite, instance and sequence tracks).
- posx: The position of asset in the sequence along the X axis for the track at the current playhead position (all assets).
- posy: The position of asset in the sequence along the Y axis for the track at the current playhead position (all assets).
- scalex: The scale of asset in the sequence along the X axis for the track at the current playhead position (sprite, instance and sequence tracks).
- scaley: The scale of asset in the sequence along the Y axis for the track at the current playhead position (sprite, instance and sequence tracks).
- xorigin: The X origin of the asset for the track (all assets).
- yorigin: The Y origin of the asset for the track (all assets).
- width: The width (in pixels) of the asset for the track (sprite, instance and sequence tracks).
- height: The height (in pixels) of the asset for the track (sprite, instance and sequence tracks).
- imageindex: The image index for the asset on the track in the sequence at the current playhead position (sprite and instance tracks).
- imagespeed: The image speed for the asset on the track in the sequence at the current playhead position (sprite and instance tracks).
- colourMultiply: The colour multiply value for the asset on the track in the sequence at the current playhead position (sprite, instance and sequence tracks). This value will be an array of
four ARGB values with the format [A, R, G, B]. Note that the values for each component are expressed as between 0 and 1, where 0 corresponds to the HEX value #00 and 1 corresponds to the HEX
value #FF (0 - 255 as shown in the colour picker for colour multiply tracks in the Sequences Editor).
- gain: The gain (volume) of the track at the current playhead position (audio tracks).
- pitch: The pitch of the track at the current playhead position (audio tracks).
- track: The track data struct that this track is based on (all assets, a read-only value).
- parent: The parent sequence instance ID for the track (all assets, a read-only value).
- activeTracks: This is an array of evaluation structs for each parameter track that the asset track contains (all assets, a read-only value). The contents of each struct in the array are listed in the parameter Track Struct section.