Installation
npm install --save @types/granim
Summary
This package contains type definitions for granim (https://github.com/sarcadass/granim.js).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/granim.
index.d.ts
export as namespace Granim;
declare class Granim {
constructor(options: Granim.Options);
play(): void;
pause(): void;
clear(): void;
changeState(stateName: string): void;
changeDirection(directionName: string): void;
changeBlendingMode(blendingModeName: string): void;
destroy(): void;
}
declare namespace Granim {
interface OnGradientChangeObject {
activeState: string;
colorsFrom: [string, string];
colorsTo: [string, string];
isLooping: boolean;
}
interface Options {
element: string | HTMLCanvasElement;
name?: string;
elToSetClassOn?: string;
direction?: "diagonal" | "left-right" | "top-bottom" | "radial" | "custom";
customDirection?: { x0: string; y0: string; x1: string; y1: string };
isPausedWhenNotInView?: boolean;
scrollDebounceThreshold?: number;
stateTransitionSpeed?: number;
defaultStateName?: string;
states: { [stateName: string]: State };
image?: Image;
onStart?: () => void;
onGradientChange?: (colorDetails: OnGradientChangeObject) => void;
onEnd?: () => void;
}
interface Gradient {
color: string;
pos: number;
}
interface State {
gradients: Array<string[] | Gradient[]>;
transitionSpeed?: number;
loop?: boolean;
}
type StretchMode = "none" | "stretch" | "stretch-if-smaller" | "stretch-if-bigger";
interface Image {
source: string;
position?: ["left" | "center" | "right", "top" | "center" | "bottom"];
stretchMode?: [StretchMode, StretchMode];
blendingMode?: string;
}
}
export = Granim;
Additional Details
- Last updated: Tue, 07 Nov 2023 03:09:37 GMT
- Dependencies: none
Credits
These definitions were written by Raiper34.