1 | var __extends = (this && this.__extends) || (function () {
|
2 | var extendStatics = Object.setPrototypeOf ||
|
3 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
4 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
5 | return function (d, b) {
|
6 | extendStatics(d, b);
|
7 | function __() { this.constructor = d; }
|
8 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
9 | };
|
10 | })();
|
11 | import { Animation } from '../animations/animation';
|
12 | import { isPresent } from '../util/util';
|
13 | import { PageTransition } from './page-transition';
|
14 | var TRANSLATEY = 'translateY';
|
15 | var OFF_BOTTOM = '40px';
|
16 | var CENTER = '0px';
|
17 | var SHOW_BACK_BTN_CSS = 'show-back-button';
|
18 | var MDTransition = (function (_super) {
|
19 | __extends(MDTransition, _super);
|
20 | function MDTransition() {
|
21 | return _super !== null && _super.apply(this, arguments) || this;
|
22 | }
|
23 | |
24 |
|
25 |
|
26 | MDTransition.prototype.init = function () {
|
27 | _super.prototype.init.call(this);
|
28 | var plt = this.plt;
|
29 | var enteringView = this.enteringView;
|
30 | var leavingView = this.leavingView;
|
31 | var opts = this.opts;
|
32 |
|
33 | var backDirection = (opts.direction === 'back');
|
34 | if (enteringView) {
|
35 | if (backDirection) {
|
36 | this.duration(isPresent(opts.duration) ? opts.duration : 200).easing('cubic-bezier(0.47,0,0.745,0.715)');
|
37 | }
|
38 | else {
|
39 | this.duration(isPresent(opts.duration) ? opts.duration : 280).easing('cubic-bezier(0.36,0.66,0.04,1)');
|
40 | this.enteringPage
|
41 | .fromTo(TRANSLATEY, OFF_BOTTOM, CENTER, true)
|
42 | .fromTo('opacity', 0.01, 1, true);
|
43 | }
|
44 | if (enteringView.hasNavbar()) {
|
45 | var enteringPageEle = enteringView.pageRef().nativeElement;
|
46 | var enteringNavbarEle = enteringPageEle.querySelector('ion-navbar');
|
47 | var enteringNavBar = new Animation(plt, enteringNavbarEle);
|
48 | this.add(enteringNavBar);
|
49 | var enteringBackButton = new Animation(plt, enteringNavbarEle.querySelector('.back-button'));
|
50 | this.add(enteringBackButton);
|
51 | if (enteringView.enableBack()) {
|
52 | enteringBackButton.beforeAddClass(SHOW_BACK_BTN_CSS);
|
53 | }
|
54 | else {
|
55 | enteringBackButton.beforeRemoveClass(SHOW_BACK_BTN_CSS);
|
56 | }
|
57 | }
|
58 | }
|
59 |
|
60 | if (leavingView && backDirection) {
|
61 |
|
62 | this.duration(opts.duration || 200).easing('cubic-bezier(0.47,0,0.745,0.715)');
|
63 | var leavingPage = new Animation(plt, leavingView.pageRef());
|
64 | this.add(leavingPage.fromTo(TRANSLATEY, CENTER, OFF_BOTTOM).fromTo('opacity', 1, 0));
|
65 | }
|
66 | };
|
67 | return MDTransition;
|
68 | }(PageTransition));
|
69 | export { MDTransition };
|
70 |
|
\ | No newline at end of file |