-
Notifications
You must be signed in to change notification settings - Fork 13.5k
/
page-transition.ts
48 lines (40 loc) · 1 KB
/
page-transition.ts
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
import { Animation } from '../animations/animation';
import { Content } from '../components/content/content';
import { Transition } from './transition';
/**
* @private
*/
export class PageTransition extends Transition {
enteringPage: Animation;
init() {
if (this.enteringView) {
this.enteringPage = new Animation(this.enteringView.pageRef());
this.add(this.enteringPage.beforeAddClass('show-page'));
// Resize content before transition starts
this.beforeAddRead(this.readDimensions.bind(this));
this.beforeAddWrite(this.writeDimensions.bind(this));
}
}
/**
* DOM READ
*/
readDimensions() {
const content = <Content>this.enteringView.getIONContent();
if (content) {
content.readDimensions();
}
}
/**
* DOM WRITE
*/
writeDimensions() {
const content = <Content>this.enteringView.getIONContent();
if (content) {
content.writeDimensions();
}
}
destroy() {
super.destroy();
this.enteringPage = null;
}
}