-
Notifications
You must be signed in to change notification settings - Fork 0
KeyChannel
Description
Returns a value from timing input, based on keys.
Remarks
Inherited from ValueChannel.
| Name | Type | Description |
|---|---|---|
name |
string | The name of the channel |
keyCount |
number | The number of keys added to this channel |
Description
Set the easing for all subsequently created keys that do not have its easing explicitly defined.
Parameters
| Name | Type | Description |
|---|---|---|
easing |
string | The easing type |
Return types
Remarks
This method returns the channel itself, which allows for chaining multiple methods.
Example
local channel = Channel.keyframe().setDefaultEasing("b")
channel.addKey(0, 10) -- easing "b"
channel.addKey(1000, 5, "so") -- easing "so"
channel.addKey(2000, 5) -- easing "b"Description
Add a key to the channel.
Parameters
| Name | Type | Description |
|---|---|---|
timing |
number | Timing of the key |
value |
number | value of the key |
easing |
string | Easing of the key |
Return types
Remarks
This method returns the channel itself, which allows for chaining multiple methods.
In case easing is not specified, or set to nil, the default easing of this channel is used.
Example
local channel = Channel.keyframe()
channel.addKey(1000, 10)
channel.addKey(2000, 5, "so")Description
Remove a key with the exact timing.
Parameters
| Name | Type | Description |
|---|---|---|
timing |
number | Timing of the key to remove |
Return types
Remarks
Currently if there are multiple keys with the same timing, this only removes the first one.
Example
local channel = Channel.keyframe().addKey(1000, 10).addKey(2000, 5, "so")
channel.removeKeyAtTiming(1000)
log(channel.keyCount)Description
Find the channel within the sub-channels that composed this.
Parameters
| Name | Type | Description |
|---|---|---|
name |
string | Name of the channel to find |
Return types
Remarks
Returns nil if no channel was found. Because this channel is not a composition channel, this means it'll only return itself if the provided name matches its own, and will always return nil otherwise.
This method is useful to detect if you have previously created a channel for a prop of a controller, which is a common need when working with note groups.
Example
local toFind = Channel.keyframe()
toFind.name = "myChannel"
track.colorA = toFind
local foundChannel = track.colorA.find("myChannel")
foundChannel.addKey(0, 255)Description
Calculate the value at a timing point.
Parameters
| Name | Type | Description |
|---|---|---|
timing |
number | Timing point to calculate at |
Return types
number
Remarks
_
Example
local saw = Channel.saw("so", Channel.constant(1000), Channel.constant(1), Channel.constant(0), Channel.constant(0))
log(saw.valueAt(500))
local keyChannel = Channel.keyframe()
track.colorA.addKey(1000, keyChannel.valueAt(1000))
track.colorA.addKey(2000, 0)| Operator | Return type | Description |
|---|---|---|
+ |
ValueChannel | Add two value channels, or a value channel with a number, or a number with a value channel together |
- |
ValueChannel | Subtract two value channels, or a value channel with a number, or a number with a value channel together |
* |
ValueChannel | Multiply two value channels, or a value channel with a number, or a number with a value channel together |
/ |
ValueChannel | Divide one value channel with another, or a value channel with a number, or a number with a value channel |
% |
ValueChannel | Modulo one value channel with another, or a value channel with a number, or a number with a value channel |
Global
- Global Functions
- Scene
- Channel
- StringChannel
- TextChannel
- Trigger
- TriggerChannel
- Context
- Event
- Convert
Channels
Controllers
- Controller
- CanvasController
- ImageController
- SpriteController
- TextController
- CameraController
- TrackController
- NoteGroupController
Internal Controllers
Data types