Library globals

Class globals . aircraft . light

View source

light
==============================================================================
class for generation of pulsing values. Appropriate for controlling
beacons, strobes, etc.

SYNOPSIS:
light.new(<property>, <pattern> [, <switch>]);
light.new(<property>, <stretch>, <pattern> [, <switch>]);

property   ... light node: property path or node
stretch    ... multiplicator for all pattern values
pattern    ... array of on/off time intervals (in seconds)
switch     ... property path or node to use as switch   (default: ./enabled)
instead of ./enabled

PROPERTIES:
./state           (bool)   (default: 0)
./enabled         (bool)   (default: 0) except if <switch> given)

EXAMPLES:
aircraft.light.new("sim/model/foo/beacon", [0.4, 0.4]);    # anonymous light
-------
var strobe = aircraft.light.new("sim/model/foo/strobe", [0.05, 0.05, 0.05, 1],
"controls/lighting/strobe");
strobe.switch(1);
-------
var switch = props.globals.getNode("controls/lighting/strobe", 1);
var pattern = [0.02, 0.03, 0.02, 1];
aircraft.light.new("sim/model/foo/strobe-top", 1.001, pattern, switch);
aircraft.light.new("sim/model/foo/strobe-bot", 1.005, pattern, switch);

Functions

blink

light.blink() -> blinking light (default) light.blink(3) -> when switched on, only run three blink sequences; second optional arg defines state after the sequences

cont

light.cont() -> continuous light

del

class destructor

new

switch

light.switch(bool) -> set light switch (also affects other lights that use the same switch)

toggle

light.toggle() -> toggle light switch