@ginden/blinkstick-v2
Version:
Improved Blickstick API for Node.js
77 lines • 2.99 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';
/**
* @summary Class to build complex animations.
* @remarks 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[];
/**
* @summary Starts an animation with a black frame.
*/
static startWithBlack(ms: number): AnimationBuilder;
/**
* @summary Starts an animation with a given color.
*/
static startWithColor(color: ColorInput, ms: number): AnimationBuilder;
protected assertNoGenerators(): void;
/**
* @summary Forks the current animation builder
* @remarks 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;
/**
* @summary Adds a static frame of single color to the animation.
*/
stillColor(color: ColorInput, ms: number): this;
/**
* @summary Adds a static frame to the animation.
*/
addStaticFrame(simpleFrame: Frame): this;
/**
* @summary Adds a pulse animation to the current animation.
*/
addPulse(color: ColorInput, overMs: number, steps?: number): this;
/**
* @summary Appends a new animation to the current one.
*/
append(animation: FrameIterable): this;
/**
* @summary 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.
* @throws If any of the current sub-animations are generators.
*/
smoothTransitionToAnimation(animation: FrameIterable, ms: number, steps?: number): this;
/**
* @summary Morphs the current animation to the given color.
* @throws If any of the current sub-animations are generators.
*/
morphToColor(color: ColorInput, ms: number): this;
/**
* @summary Waits for the given time, retaining current color and state.
* @param ms
*/
wait(ms: number): void;
/**
* @summary Repeats the current animation the given number of times.
* @throws If any of the current sub-animations are generators.
*/
repeat(times: number): this;
/**
* @summary Apply a transformation to each frame of the current animation.
* @throws If any of the current sub-animations are generators.
*/
transformEachFrame(transform: TransformEachFrameCb): this;
/**
* @summary Builds the final animation.
*/
build(): AsyncIterable<Frame>;
}
//# sourceMappingURL=animation-builder.d.ts.map