mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Updated the animations API
This commit is contained in:
@@ -27,7 +27,7 @@ export interface PropertyAnimation {
|
|||||||
curve?: any;
|
curve?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CustomAnimationCurve implements definition.CustomAnimationCurve {
|
export class CubicBezierAnimationCurve implements definition.CubicBezierAnimationCurve {
|
||||||
|
|
||||||
public x1: number;
|
public x1: number;
|
||||||
public y1: number;
|
public y1: number;
|
||||||
|
|||||||
@@ -327,9 +327,9 @@ export function _resolveAnimationCurve(curve: any): any {
|
|||||||
return bounce;
|
return bounce;
|
||||||
default:
|
default:
|
||||||
trace.write("Animation curve resolved to original: " + curve, trace.categories.Animation);
|
trace.write("Animation curve resolved to original: " + curve, trace.categories.Animation);
|
||||||
if (curve instanceof common.CustomAnimationCurve) {
|
if (curve instanceof common.CubicBezierAnimationCurve) {
|
||||||
var animationCurve = <common.CustomAnimationCurve>curve;
|
var animationCurve = <common.CubicBezierAnimationCurve>curve;
|
||||||
var interpolator = (<any>(<any>(<any>android.support.v4.view).animation).PathInterpolatorCompat).create(animationCurve.x1, animationCurve.y1, animationCurve.x2, animationCurve.y2);
|
var interpolator = (<any>android).support.v4.view.animation.PathInterpolatorCompat.create(animationCurve.x1, animationCurve.y1, animationCurve.x2, animationCurve.y2);
|
||||||
return interpolator;
|
return interpolator;
|
||||||
}
|
}
|
||||||
return curve;
|
return curve;
|
||||||
|
|||||||
2
ui/animation/animation.d.ts
vendored
2
ui/animation/animation.d.ts
vendored
@@ -64,7 +64,7 @@
|
|||||||
* Defines a custom animation timing curve by using the cubic-bezier function.
|
* Defines a custom animation timing curve by using the cubic-bezier function.
|
||||||
* Possible values are numeric values from 0 to 1
|
* Possible values are numeric values from 0 to 1
|
||||||
*/
|
*/
|
||||||
export class CustomAnimationCurve {
|
export class CubicBezierAnimationCurve {
|
||||||
|
|
||||||
public x1: number;
|
public x1: number;
|
||||||
public y1: number;
|
public y1: number;
|
||||||
|
|||||||
@@ -517,8 +517,8 @@ export function _resolveAnimationCurve(curve: any): any {
|
|||||||
if (curve instanceof CAMediaTimingFunction) {
|
if (curve instanceof CAMediaTimingFunction) {
|
||||||
return curve;
|
return curve;
|
||||||
}
|
}
|
||||||
else if (curve instanceof common.CustomAnimationCurve) {
|
else if (curve instanceof common.CubicBezierAnimationCurve) {
|
||||||
var animationCurve = <common.CustomAnimationCurve>curve;
|
var animationCurve = <common.CubicBezierAnimationCurve>curve;
|
||||||
return CAMediaTimingFunction.functionWithControlPoints(animationCurve.x1, animationCurve.y1, animationCurve.x2, animationCurve.y2);
|
return CAMediaTimingFunction.functionWithControlPoints(animationCurve.x1, animationCurve.y1, animationCurve.x2, animationCurve.y2);
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|||||||
8
ui/enums/enums.d.ts
vendored
8
ui/enums/enums.d.ts
vendored
@@ -1,5 +1,7 @@
|
|||||||
declare module "ui/enums" {
|
declare module "ui/enums" {
|
||||||
|
|
||||||
|
import animationModule = require("ui/animation");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a soft keyboard flavor.
|
* Represents a soft keyboard flavor.
|
||||||
*/
|
*/
|
||||||
@@ -522,6 +524,7 @@
|
|||||||
* Represents an animation curve type.
|
* Represents an animation curve type.
|
||||||
*/
|
*/
|
||||||
module AnimationCurve {
|
module AnimationCurve {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An ease-in curve causes the animation to begin slowly, and then speed up as it progresses.
|
* An ease-in curve causes the animation to begin slowly, and then speed up as it progresses.
|
||||||
*/
|
*/
|
||||||
@@ -546,5 +549,10 @@
|
|||||||
* A spring animation curve causes an animation to produce a spring (bounce) effect.
|
* A spring animation curve causes an animation to produce a spring (bounce) effect.
|
||||||
*/
|
*/
|
||||||
export var spring: string;
|
export var spring: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A custom cubic bezier function defined by its two control points. Possible values are numeric values from 0 to 1
|
||||||
|
*/
|
||||||
|
export function cubicBezier(x1: number, y1: number, x2: number, y2: number): animationModule.CubicBezierAnimationCurve;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export module KeyboardType {
|
import animationModule = require("ui/animation");
|
||||||
|
|
||||||
|
export module KeyboardType {
|
||||||
export var datetime = "datetime";
|
export var datetime = "datetime";
|
||||||
export var phone = "phone";
|
export var phone = "phone";
|
||||||
export var number = "number";
|
export var number = "number";
|
||||||
@@ -163,4 +165,7 @@ export module AnimationCurve {
|
|||||||
export var easeInOut = "easeInOut";
|
export var easeInOut = "easeInOut";
|
||||||
export var linear = "linear";
|
export var linear = "linear";
|
||||||
export var spring = "spring";
|
export var spring = "spring";
|
||||||
|
export function cubicBezier(x1: number, y1: number, x2: number, y2: number): animationModule.CubicBezierAnimationCurve {
|
||||||
|
return new animationModule.CubicBezierAnimationCurve(x1, y1 ,x2, y2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user