/
animation.d.ts
109 lines (92 loc) · 3.41 KB
/
animation.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
declare module "ui/animation" {
import viewModule = require("ui/core/view");
import colorModule = require("color");
/**
* Defines animation options for the View.animate method.
*/
export interface AnimationDefinition {
/**
* The view whose property is to be animated.
*/
target?: viewModule.View;
/**
* Animates the opacity of the view. Value should be a number between 0.0 and 1.0
*/
opacity?: number;
/**
* Animates the backgroundColor of the view.
*/
backgroundColor?: colorModule.Color;
/**
* Animates the translate affine transform of the view.
*/
translate?: Pair;
/**
* Animates the scale affine transform of the view.
*/
scale?: Pair;
/**
* Animates the rotate affine transform of the view. Value should be a number specifying the rotation amount in degrees.
*/
rotate?: number;
/**
* The length of the animation in milliseconds. The default duration is 300 milliseconds.
*/
duration?: number;
/**
* The amount of time, in milliseconds, to delay starting the animation.
*/
delay?: number;
/**
* Specifies how many times the animation should be played. Default is 1.
* iOS animations support fractional iterations, i.e. 1.5.
* To repeat an animation infinitely, use Number.POSITIVE_INFINITY
*/
iterations?: number;
/**
* An optional animation curve. Possible values are contained in the [AnimationCurve enumeration](../enums/AnimationCurve/README.md).
* Alternatively, you can pass an instance of type UIViewAnimationCurve for iOS or android.animation.TimeInterpolator for Android.
*/
curve?: any;
}
/**
* Defines a custom animation timing curve by using the cubic-bezier function.
* Possible values are numeric values from 0 to 1
*/
export class CubicBezierAnimationCurve {
public x1: number;
public y1: number;
public x2: number;
public y2: number;
constructor(x1: number, y1: number, x2: number, y2: number);
}
/**
* Defines a pair of values (horizontal and vertical) for translate and scale animations.
*/
export interface Pair {
x: number;
y: number;
}
/**
* Create Promise that can cancel the animation, we have to pretend our returns itself along with the cancel
*/
export class AnimationPromise extends Promise<void> {
cancel(): void;
then(onFulfilled?: (value?: any) => PromiseLike<void>, onRejected?: (error?: any) => PromiseLike<void>): AnimationPromise;
then(onFulfilled?: (value?: any) => void, onRejected?: (error?: any) => void): AnimationPromise;
catch(onRejected?: (error?: any) => PromiseLike<void>): AnimationPromise;
catch(onRejected?: (error?: any) => void): AnimationPromise;
}
/**
* Defines a animation set.
*/
export class Animation {
constructor(animationDefinitions: Array<AnimationDefinition>, playSequentially?: boolean);
public play: () => AnimationPromise;
public cancel: () => void;
public isPlaying: boolean;
}
//@private
export function _resolveAnimationCurve(curve: any): any;
//@endprivate
}