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

BREAKING CHANGE: AndroidTransitionType is now a static member of the Transition class. BEFORE: ``` import { AndroidTransitionType } from '@nativescript/core/ui/transition'; ``` AFTER: ``` import { Transition } from '@nativescript/core'; Transition.AndroidTransitionType.enter; // etc. ```
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
// Types.
|
|
import { _resolveAnimationCurve } from '../animation';
|
|
import lazy from '../../utils/lazy';
|
|
|
|
const _defaultInterpolator = lazy(() => new android.view.animation.AccelerateDecelerateInterpolator());
|
|
|
|
let transitionId = 0;
|
|
export class Transition {
|
|
static AndroidTransitionType = {
|
|
enter: 'enter',
|
|
exit: 'exit',
|
|
popEnter: 'popEnter',
|
|
popExit: 'popExit',
|
|
};
|
|
private _duration: number;
|
|
private _interpolator: android.view.animation.Interpolator;
|
|
private _id: number;
|
|
|
|
constructor(duration: number, curve: any) {
|
|
this._duration = duration;
|
|
this._interpolator = curve ? _resolveAnimationCurve(curve) : _defaultInterpolator();
|
|
this._id = transitionId++;
|
|
}
|
|
|
|
public getDuration(): number {
|
|
return this._duration;
|
|
}
|
|
|
|
public getCurve(): android.view.animation.Interpolator {
|
|
return this._interpolator;
|
|
}
|
|
|
|
public animateIOSTransition(containerView: any, fromView: any, toView: any, operation: any, completion: (finished: boolean) => void): void {
|
|
throw new Error('Abstract method call');
|
|
}
|
|
|
|
public createAndroidAnimator(transitionType: string): android.animation.Animator {
|
|
throw new Error('Abstract method call');
|
|
}
|
|
|
|
public toString(): string {
|
|
return `Transition@${this._id}`;
|
|
}
|
|
}
|