blinkstick-ts
Version:
BlinkStick TypeScript implementation
96 lines (95 loc) • 3.38 kB
TypeScript
import { Color } from "./color";
import { Led } from "./led.interface";
export interface IAnimator {
}
/**
* Blinks specified RGB color.
*
* Function supports the following overloads:
*
* @example
* //Available overloads
* blink(red, green, blue, [options], [callback]); // use [0..255] ranges for intensity
*
* blink(color, [options], [callback]); // use '#rrggbb' format
*
* blink(color_name, [options], [callback]); // use 'random', 'red', 'green', 'yellow' and other CSS supported names
*
* Options can contain the following parameters for object:
*
* - channel=0: Channel is represented as 0=R, 1=G, 2=B
* - index=0: The index of the LED
* - repeats=1: How many times to blink
* - delay=1: Delay between on/off cycles in milliseconds
*
* @param {Led} led The led to blink
* @param {Color} color The Color to blink
* @param {Number} [repeats] How many times to blink
* @param {Number} [delay] Delay between on/off cycles in milliseconds, defaults to 10
*/
export declare class BlinkAnimator {
private readonly led;
private readonly color;
private readonly repeats;
private readonly delay;
private enabled;
private count;
constructor(led: Led, color: Color, repeats?: number, delay?: number);
animate(): Promise<void>;
}
/**
* Morphs to specified RGB color from current color.
*
* Function supports the following overloads:
*
* @example
* //Available overloads
* morph(red, green, blue, [options], [callback]); // use [0..255] ranges for intensity
*
* morph(color, [options], [callback]); // use '#rrggbb' format
*
* morph(color_name, [options], [callback]); // use 'random', 'red', 'green', 'yellow' and other CSS supported names
*
* @param {Led} led The led to morph
* @param {Color} color The Color to morph to
* @param {Number} [duration] How long should the morph animation last in milliseconds, defaults to 1000
* @param {Number} [steps] How many steps for color changes, defaults to 50
*/
export declare class MorphAnimator {
private readonly led;
private readonly color;
private readonly duration;
private readonly steps;
private enabled;
private count;
constructor(led: Led, color: Color, duration?: number, steps?: number);
animate(): Promise<void>;
}
/**
* Pulses specified RGB color.
*
* Function supports the following overloads:
*
* @example
* //Available overloads
* pulse(red, green, blue, [options], [callback]); // use [0..255] ranges for intensity
*
* pulse(color, [options], [callback]); // use '#rrggbb' format
*
* pulse(color_name, [options], [callback]); // use 'random', 'red', 'green', 'yellow' and other CSS supported names
*
* @param {Led} led The led to pulse
* @param {Color} color The Color to pulse to first
* @param {Color} color The Color to pulse to afterwards, defaults to black
* @param {Number} [duration] How long should the pulse animation last in milliseconds, defaults to 1000
* @param {Number} [steps] How many steps for color changes, defaults to 50
*/
export declare class PulseAnimator {
private readonly led;
private readonly color1;
private readonly color2;
private readonly duration;
private readonly steps;
constructor(led: Led, color1: Color, color2?: Color, duration?: number, steps?: number);
animate(): Promise<void>;
}