This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
dragengine:modules:dragonscript:behavior_lightdimmer [2025/06/19 12:37] – removed - external edit (Unknown date) 127.0.0.1 | dragengine:modules:dragonscript:behavior_lightdimmer [2025/06/19 12:37] (current) – ↷ Page name changed from dragengine:modules:dragonscript:behavior_lightdimmerr to dragengine:modules:dragonscript:behavior_lightdimmer dragonlord | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | {{tag> | ||
+ | <WRAP youarehere> | ||
+ | [[: | ||
+ | </ | ||
+ | |||
+ | * [[behaviors_use_cases|Behaviors Explained: By Use-Case]] | ||
+ | * [[behaviors_a_to_z|Behaviors Explained: From A to Z]] | ||
+ | |||
+ | ====== ECBehaviorLightDimmer ====== | ||
+ | |||
+ | Behavior element behavior adding dimming support to [[behavior_light|ECBehaviorLight]]. | ||
+ | |||
+ | This behavior modifies the light parameters of [[behavior_light|ECBehaviorLight]] instances present in the element to make lights gently raise and lower intensity when (de)activated. | ||
+ | |||
+ | To use this behavior add first an [[behavior_light|ECBehaviorLight]]. Adding ECBehaviorLightDimmer will then register itself as listener to the [[behavior_light|ECBehaviorLight]] and also set it to use custom light handling. | ||
+ | |||
+ | ====== Instance Counts ====== | ||
+ | This behavior can be used multiple times on an element to affect different lights. Use the behavior identifier to tell them apart. | ||
+ | |||
+ | ====== Element Class Properties ====== | ||
+ | Element class properties have the prefix '' | ||
+ | |||
+ | ===== timeRaise ===== | ||
+ | Set time in seconds required to raise light intensity to full brightness. | ||
+ | * Full name: '' | ||
+ | * Type: float | ||
+ | * Default Value: 1 | ||
+ | * Restriction: | ||
+ | * Example (*.deeclass) <code xml>< | ||
+ | |||
+ | ===== timeLower ===== | ||
+ | Set time in seconds required to lower light intensity to 0 intensity. | ||
+ | * Full name: '' | ||
+ | * Type: float | ||
+ | * Default Value: 1 | ||
+ | * Restriction: | ||
+ | * Example (*.deeclass) <code xml>< | ||
+ | |||
+ | ====== Events ====== | ||
+ | |||
+ | This behavior has no events. | ||
+ | |||
+ | ====== Required Behaviors ====== | ||
+ | |||
+ | * [[behavior_light|ECBehaviorLight]]: | ||
+ | |||
+ | ====== Optional Behaviors ====== | ||
+ | |||
+ | This behavior does not support optional behaviors. | ||
+ | |||
+ | ====== Persistency ====== | ||
+ | |||
+ | This behavior does support element class to be persistable (setPersistable). | ||
+ | |||
+ | ====== API Documentation ====== | ||
+ | |||
+ | # | ||
+ | |||
+ | Since DragonScript Module Version '' | ||
+ | |||
+ | ====== Use Cases ====== | ||
+ | |||
+ | * Change light switch on and off to gradually fade in and out. | ||
+ | |||
+ | ====== Element Class Example ====== | ||
+ | |||
+ | This example defines an element which contains a light with dimming support. | ||
+ | |||
+ | < | ||
+ | class MyElement extends BehaviorElementClass | ||
+ | public var ECBehaviorLight light | ||
+ | public var ECBehaviorLightDimmer lightDimmer | ||
+ | func new() | ||
+ | light = ECBehaviorLight.new(this, | ||
+ | lightDimmer = ECBehaviorLightDimmer.new(this, | ||
+ | lightDimmer.getTimeRaise().setValue(2) | ||
+ | lightDimmer.getTimeLower().setValue(0.5) | ||
+ | end | ||
+ | end | ||
+ | </ | ||
+ | |||
+ | ====== Behavior Factory ====== | ||
+ | |||
+ | Using element class supporting adding behaviors the behavior can be added like this: | ||
+ | <code xml> | ||
+ | <?xml version=' | ||
+ | < | ||
+ | < | ||
+ | | ||
+ | < | ||
+ | <!-- optional: use light with id instead of empty string --> | ||
+ | <string name=' | ||
+ | | ||
+ | <!-- set element properties. omit property prefix if used inside behavior tag --> | ||
+ | <float name=' | ||
+ | </ | ||
+ | | ||
+ | <!-- for adding multiple behaviors use unique identifiers --> | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ====== Live Examples ====== | ||
+ | |||
+ | * [[https:// | ||