Files
NativeScript/tns-core-modules/ui/animation/keyframe-animation.d.ts
Stanimira Vlaeva 9bba250424 Refactor transform animations (#4296)
* feat: add matrix module

* fix(animations): parse transform property correctly

* fix(css-animations): compute transformation value with matrix

* refactor: add typings for keyframes array in style scope

* fix(animations): transform regex and method invocation

* fix(matrix): rewrite decomposition function

* refactor: transform animations parse

* test: add tests for css animation transform

* refactor: move transformConverter to style-properties

* lint: remove unnecessary comma

* lint: remove unnecessary word in d.ts

* fix(style-properties): correctly use transformConverter

* fix(matrix): flat multiply affine 2d matrices

cc @PanayotCankov
2017-06-09 18:20:07 +03:00

113 lines
2.7 KiB
TypeScript

/**
* @module "ui/animation/keyframe-animation"
*/ /** */
import { View } from "../core/view";
export declare const ANIMATION_PROPERTIES;
export interface Keyframes {
name: string;
keyframes: Array<UnparsedKeyframe>;
}
export interface UnparsedKeyframe {
values: Array<any>;
declarations: Array<KeyframeDeclaration>;
}
export interface KeyframeDeclaration {
property: string;
value: any;
}
export interface KeyframeInfo {
duration: number;
curve: any;
declarations: Array<KeyframeDeclaration>;
}
/**
* Defines animation options for the View.animate method.
*/
export class KeyframeAnimationInfo {
/**
* The animation name.
*/
name: string;
/**
* 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](../modules/_ui_enums_.animationcurve.html).
* Alternatively, you can pass an instance of type UIViewAnimationCurve for iOS or android.animation.TimeInterpolator for Android.
*/
curve: any;
/**
* Determines whether the animation values will be applied on the animated object after the animation finishes.
*/
isForwards: boolean;
/**
* If true the animation will be played backwards.
*/
isReverse: boolean;
/**
* Return animation keyframes.
*/
keyframes: Array<KeyframeInfo>;
}
export class KeyframeAnimation {
/**
* 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;
/**
* Returns true if the application is currently running.
*/
isPlaying: boolean;
/**
* Plays the animation.
*/
public play: (view: View) => Promise<void>;
/**
* Cancels a playing animation.
*/
public cancel: () => void;
/**
* Creates a keyframe animation from animation definition.
*/
public static keyframeAnimationFromInfo(info: KeyframeAnimationInfo): KeyframeAnimation;
}