Builtin Library
- ..
- README.md2.2 KB
- init.luau14.9 KB
- inspector.luau7.4 KB
README.md
Effect
Plays one entry of an effect on its entity. Every graph the entry holds runs on
a Generator under this entity, from the same moment, each given the inputs it
declares; the entity's transform is where the effect stands, and it moves with
the entity. effectRef:play hands these out from gameplay; one placed in a
scene, or dropped into the viewport, plays the same way.
Fields
| Field | What it does |
|---|---|
effect | The effect this plays. |
entry | The entry it plays, as the effect's effect.yaml lists it under plays; empty plays the effect's default. |
inputs | Values for the entry's inputs, by input name; an input left out takes its default. A name no graph of the entry declares is refused, naming the inputs it does take. |
playOn | What starts it in play mode: load plays as soon as it binds, manual waits for play(). In edit mode an Effect is not set to play, whatever playOn says: it shows the frame it is on until it is played. |
ending | At the end of its timeline: graph does what the timeline declares, loop plays it round again, hold stays on the last frame. |
speed | How fast it plays: 1 its own rate, 0 still, negative backwards through a timeline with an end. |
Methods and events
play() plays the entry from its start; pause(), resume(), seek(seconds)
and stop() drive it, and stop() also takes what it shows away.
set(input, value) changes one input. getTime() and isFinished() read where
it stands, isPrepared() whether its graphs have done the work its first frame
needs (every frame of a timeline with an end cooked, one with no end on the
device), and playback() what it costs: the entry's combined numbers, and
each graph's own playback() under graphs. onFinished fires when every graph of the entry has reached the end
of its timeline.
From gameplay
A shot, a hit or an explosion is a play of an effect's entry, from the effect itself; it is kept ready and goes back to be played again when it finishes:
local beacons = asset.resolve("beacons", "effect")
beacons:play("flare", { root = mast, offset = { 0, 0.9, 0 }, inputs = { size = 0.4 } })