mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 04:53:58 +08:00

Created interfaces for NavOptions, AnimationOptions and TransitionOptions Created Transition class and move transition ts files to their own folder.
42 lines
1016 B
TypeScript
42 lines
1016 B
TypeScript
import {Animation} from '../animations/animation';
|
|
import {ViewController} from '../components/nav/view-controller';
|
|
|
|
|
|
/**
|
|
* @private
|
|
**/
|
|
export class Transition extends Animation {
|
|
|
|
constructor(opts: TransitionOptions) {
|
|
super(null, {
|
|
renderDelay: opts.renderDelay
|
|
});
|
|
}
|
|
|
|
static createTransition(enteringView: ViewController, leavingView: ViewController, opts: TransitionOptions): Transition {
|
|
let TransitionClass = TransitionRegistry[opts.animation];
|
|
if (!TransitionClass) {
|
|
// didn't find a transition animation, default to ios-transition
|
|
TransitionClass = TransitionRegistry['ios-transition'];
|
|
}
|
|
|
|
return new TransitionClass(enteringView, leavingView, opts);
|
|
}
|
|
|
|
static register(name: string, TransitionClass) {
|
|
TransitionRegistry[name] = TransitionClass;
|
|
}
|
|
|
|
}
|
|
|
|
export interface TransitionOptions {
|
|
animation: string;
|
|
duration: number;
|
|
easing: string;
|
|
direction: string;
|
|
renderDelay?: number;
|
|
isRTL?: boolean;
|
|
}
|
|
|
|
let TransitionRegistry = {};
|