mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 11:01:21 +08:00

* chore: move tns-core-modules to nativescript-core * chore: preparing compat generate script * chore: add missing definitions * chore: no need for http-request to be private * chore: packages chore * test: generate tests for tns-core-modules * chore: add anroid module for consistency * chore: add .npmignore * chore: added privateModulesWhitelist * chore(webpack): added bundle-entry-points * chore: scripts * chore: tests changed to use @ns/core * test: add scoped-packages test project * test: fix types * test: update test project * chore: build scripts * chore: update build script * chore: npm scripts cleanup * chore: make the compat pgk work with old wp config * test: generate diff friendly tests * chore: create barrel exports * chore: move files after rebase * chore: typedoc config * chore: compat mode * chore: review of barrels * chore: remove tns-core-modules import after rebase * chore: dev workflow setup * chore: update developer-workflow * docs: experiment with API extractor * chore: api-extractor and barrel exports * chore: api-extractor configs * chore: generate d.ts rollup with api-extractor * refactor: move methods inside Frame * chore: fic tests to use Frame static methods * refactor: create Builder class * refactor: use Builder class in tests * refactor: include Style in ui barrel * chore: separate compat build script * chore: fix tslint errors * chore: update NATIVESCRIPT_CORE_ARGS * chore: fix compat pack * chore: fix ui-test-app build with linked modules * chore: Application, ApplicationSettings, Connectivity and Http * chore: export Trace, Profiling and Utils * refactor: Static create methods for ImageSource * chore: fix deprecated usages of ImageSource * chore: move Span and FormattedString to ui * chore: add events-args and ImageSource to index files * chore: check for CLI >= 6.2 when building for IOS * chore: update travis build * chore: copy Pod file to compat package * chore: update error msg ui-tests-app * refactor: Apply suggestions from code review Co-Authored-By: Martin Yankov <m.i.yankov@gmail.com> * chore: typings and refs * chore: add missing d.ts files for public API * chore: adress code review FB * chore: update api-report * chore: dev-workflow for other apps * chore: api update * chore: update api-report
147 lines
3.5 KiB
TypeScript
147 lines
3.5 KiB
TypeScript
/**
|
|
* @module "ui/animation"
|
|
*/ /** */
|
|
|
|
import { View, Color } from "../core/view";
|
|
import { PercentLength } from "../styling/style-properties";
|
|
|
|
/**
|
|
* Defines animation options for the View.animate method.
|
|
*/
|
|
export interface AnimationDefinition {
|
|
/**
|
|
* The view whose property is to be animated.
|
|
*/
|
|
target?: 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?: Color;
|
|
|
|
/**
|
|
* Animates the translate affine transform of the view.
|
|
*/
|
|
translate?: Pair;
|
|
|
|
/**
|
|
* Animates the scale affine transform of the view.
|
|
*/
|
|
scale?: Pair;
|
|
|
|
/**
|
|
* Animates the height of a view.
|
|
*/
|
|
height?: PercentLength | string;
|
|
|
|
/**
|
|
* Animates the width of a view.
|
|
*/
|
|
width?: PercentLength | string;
|
|
|
|
/**
|
|
* 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](../modules/_ui_enums_.animationcurve.html).
|
|
* 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 key-value pair for css transformation
|
|
*/
|
|
export type Transformation = {
|
|
property: TransformationType;
|
|
value: TransformationValue;
|
|
};
|
|
|
|
/**
|
|
* Defines possible css transformations
|
|
*/
|
|
export type TransformationType = "rotate" |
|
|
"translate" | "translateX" | "translateY" |
|
|
"scale" | "scaleX" | "scaleY";
|
|
|
|
/**
|
|
* Defines possible css transformation values
|
|
*/
|
|
export type TransformationValue = Pair | number;
|
|
|
|
/**
|
|
* Defines a pair of values (horizontal and vertical) for translate and scale animations.
|
|
*/
|
|
export interface Pair {
|
|
x: number;
|
|
y: number;
|
|
}
|
|
|
|
/**
|
|
* Defines full information for css transformation
|
|
*/
|
|
export type TransformFunctionsInfo = {
|
|
translate: Pair,
|
|
rotate: number,
|
|
scale: Pair,
|
|
}
|
|
|
|
export interface Cancelable {
|
|
cancel(): void;
|
|
}
|
|
|
|
/**
|
|
* A Promise that can cancel the animation.
|
|
*/
|
|
export type AnimationPromise = Promise<void> & Cancelable;
|
|
|
|
/**
|
|
* Defines a animation set.
|
|
*/
|
|
export class Animation {
|
|
constructor(animationDefinitions: Array<AnimationDefinition>, playSequentially?: boolean);
|
|
public play: (resetOnFinish?: boolean) => AnimationPromise;
|
|
public cancel: () => void;
|
|
public isPlaying: boolean;
|
|
public _resolveAnimationCurve(curve: any): any;
|
|
}
|
|
|
|
export function _resolveAnimationCurve(curve: any): any;
|