forked from ionic-team/ionic-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtransition.ts
More file actions
57 lines (48 loc) · 1.58 KB
/
transition.ts
File metadata and controls
57 lines (48 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { Animation } from '../animations/animation';
import { closest } from '../util/dom';
import { Content } from '../components/content/content';
import { Tabs } from '../components/tabs/tabs';
import { ViewController } from '../components/nav/view-controller';
/**
* @private
*
* - play
* - Add before classes - DOM WRITE
* - Remove before classes - DOM WRITE
* - Add before inline styles - DOM WRITE
* - set inline FROM styles - DOM WRITE
* - RAF
* - read toolbar dimensions - DOM READ
* - write content top/bottom padding - DOM WRITE
* - set css transition duration/easing - DOM WRITE
* - RAF
* - set inline TO styles - DOM WRITE
*/
export class Transition extends Animation {
constructor(public enteringView: ViewController, leavingView: ViewController, 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: any) {
TransitionRegistry[name] = TransitionClass;
}
}
export interface TransitionOptions {
animation: string;
duration: number;
easing: string;
direction: string;
renderDelay?: number;
isRTL?: boolean;
ev?: any;
}
let TransitionRegistry: any = {};