@ginden/blinkstick-v2
Version:
Improved Blickstick API for Node.js
54 lines • 2.1 kB
TypeScript
import type { FrameIterable } from './animation-description';
import type { Frame } from './frame/frame';
import type { ColorInput } from '../types';
import { TransformEachFrameCb } from './helpers/transform-each-frame';
/**
* Our primary class for building complex animations.
* You SHOULD use static methods to create an instance of this class,
* but you are an adult. You can extend this class and use it as you want.
* @category Animation
*/
export declare class AnimationBuilder {
protected subAnimations: FrameIterable[];
static startWithBlack(ms: number): AnimationBuilder;
static startWithColor(color: ColorInput, ms: number): AnimationBuilder;
protected assertNoGenerators(): void;
/**
* Forks the current animation builder, allowing to create a new animation
* that is a copy of the current one.
* If any of the animations are generators, an error will be thrown.
*/
fork(): AnimationBuilder;
stillColor(color: ColorInput, ms: number): this;
addStaticFrame(simpleFrame: Frame): this;
addPulse(color: ColorInput, overMs: number, steps?: number): this;
/**
* Appends a new animation to the current one.
* @param animation
*/
append(animation: FrameIterable): this;
/**
* Appends a new animation to the current one, but provides smooth transition between last frame of the current animation
* and first frame of the new one.
*/
smoothTransitionToAnimation(animation: FrameIterable, ms: number, steps?: number): this;
/**
* Morphs the current animation to the given color.
* @param color
* @param ms
*/
morphToColor(color: ColorInput, ms: number): this;
/**
* Waits for the given time, retaining current color and state.
* @param ms
*/
wait(ms: number): void;
/**
* Repeats the current animation the given number of times.
* @param times
*/
repeat(times: number): this;
transformEachFrame(transform: TransformEachFrameCb): this;
build(): AsyncIterable<Frame>;
}
//# sourceMappingURL=animation-builder.d.ts.map