UNPKG

1.58 kBTypeScriptView Raw
1declare function CountUp(target: string, startVal: number, endVal: number, decimals: number, duration: number, options: any): void;
2
3declare module CountUp {
4 var options: CountUpOptions;
5
6 function version(): string;
7
8 function printValue(value: any): void;
9
10 function count(timestamp: any): void;
11
12 // start your animation
13 function start(callback: Function): boolean;
14
15 // toggles pause/resume animation
16 function pauseResume(): void;
17
18 // reset to startVal so animation can be run again
19 function reset(): void;
20
21 // pass a new endVal and start animation
22 function update(newEndVal: number): void;
23}
24
25interface CountUp {
26 // target = id of html element or var of previously selected html element where counting occurs
27 // startVal = the value you want to begin at
28 // endVal = the value you want to arrive at
29 // decimals = number of decimal places, default 0
30 // duration = duration of animation in seconds, default 2
31 // options = optional object of options (see below)
32 new(target: string, startVal: number, endVal: number, decimals: number, duration: number, options: any): CountUp;
33}
34
35interface CountUpOptions {
36 useEasing: boolean; // toggle easing
37 useGrouping: boolean; // 1,000,000 vs 1000000
38 separator: string; // character to use as a separator
39 decimal: string; // character to use as a decimal
40 easingFn: Function; // optional custom easing closure function, default is Robert Penner's easeOutExpo
41 formattingFn: Function; // optional custom formatting function, default is self.formatNumber below
42}
43
44export = CountUp;