|
Treehopper C# API
|
An LED fader effect More...
Public Member Functions | |
| LedFadeAnimation (bool usePrecisionTimer=false) | |
| Create a new LED fade animation More... | |
| Task | RunAsync (double from=0, double to=1) |
| Run the animation More... | |
Properties | |
| Led | Led [get, set] |
| Gets or sets the LED to fade. More... | |
| double | Duration [get, set] |
| Gets or sets the duration of the fade, in milliseconds. More... | |
An LED fader effect
To fade an LED, construct an instance of this class, then set Led to the LED you wish to fade. Set the Duration of the fade, and then call RunAsync(double, double) to actually run the fade. You can switch the fader to use a different LED at any time — there's no need to construct multiple instances of this class if only one LED needs to be faded at any given time.
The fade is performed using a linear interpolation; since Led.Brightness is linearly perceptual, this will create a linear change in brightness during the course of the fade.
| LedFadeAnimation | ( | bool | usePrecisionTimer = false | ) |
Create a new LED fade animation
| usePrecisionTimer | Whether to use the (CPU-heavy) precision timer |
| Task RunAsync | ( | double | from = 0, |
| double | to = 1 |
||
| ) |
Run the animation
| from | The starting value |
| to | The finished value |
|
getset |
Gets or sets the duration of the fade, in milliseconds.