Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

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

FieldWhat it does
effectThe effect this plays.
entryThe entry it plays, as the effect's effect.yaml lists it under plays; empty plays the effect's default.
inputsValues 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.
playOnWhat 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.
endingAt the end of its timeline: graph does what the timeline declares, loop plays it round again, hold stays on the last frame.
speedHow 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 } })