forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spin.d.ts
50 lines (44 loc) · 2.09 KB
/
spin.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Type definitions for Spin.js 2.3.2
// Project: http://fgnass.github.com/spin.js/
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Theodore Brown <https://github.com/theodorejb/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface SpinnerOptions {
lines?: number; // The number of lines to draw
length?: number; // The length of each line
width?: number; // The line thickness
radius?: number; // The radius of the inner circle
corners?: number; // Corner roundness (0..1)
rotate?: number; // The rotation offset
direction?: number; // 1: clockwise, -1: counterclockwise
color?: any; // #rgb or #rrggbb or array of colors
speed?: number; // Rounds per second
trail?: number; // Afterglow percentage
shadow?: boolean; // Whether to render a shadow
hwaccel?: boolean; // Whether to use hardware acceleration
className?: string; // The CSS class to assign to the spinner
zIndex?: number; // The z-index (defaults to 2000000000)
top?: string; // Top position relative to parent in px
left?: string; // Left position relative to parent in px
scale?: number; // Scales overall size of the spinner
opacity?: number; // Opacity of the lines
fps?: number; // Frames per second when using setTimeout() as a fallback for CSS
position?: string; // Element positioning
}
declare class Spinner {
/** The Spinner's HTML element - can be used to manually insert the spinner into the DOM */
public el: HTMLElement;
constructor(options?: SpinnerOptions);
/**
* Adds the spinner to the given target element. If this instance is already
* spinning, it is automatically removed from its previous target by calling
* stop() internally.
*/
spin(target?: HTMLElement): Spinner;
/**
* Stops and removes the Spinner.
* Stopped spinners may be reused by calling spin() again.
*/
stop(): Spinner;
lines(el:HTMLElement, o:SpinnerOptions):HTMLElement;
opacity(el:HTMLElement, i:number, val:number, o:SpinnerOptions):void;
}