UNPKG

3.33 kBJavaScriptView Raw
1var __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})();
11import { Animation } from '../animations/animation';
12import { isPresent } from '../util/util';
13import { PageTransition } from './page-transition';
14var /** @type {?} */ TRANSLATEY = 'translateY';
15var /** @type {?} */ OFF_BOTTOM = '40px';
16var /** @type {?} */ CENTER = '0px';
17var /** @type {?} */ SHOW_BACK_BTN_CSS = 'show-back-button';
18var MDTransition = (function (_super) {
19 __extends(MDTransition, _super);
20 function MDTransition() {
21 return _super !== null && _super.apply(this, arguments) || this;
22 }
23 /**
24 * @return {?}
25 */
26 MDTransition.prototype.init = function () {
27 _super.prototype.init.call(this);
28 var /** @type {?} */ plt = this.plt;
29 var /** @type {?} */ enteringView = this.enteringView;
30 var /** @type {?} */ leavingView = this.leavingView;
31 var /** @type {?} */ opts = this.opts;
32 // what direction is the transition going
33 var /** @type {?} */ 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 /** @type {?} */ enteringPageEle = enteringView.pageRef().nativeElement;
46 var /** @type {?} */ enteringNavbarEle = enteringPageEle.querySelector('ion-navbar');
47 var /** @type {?} */ enteringNavBar = new Animation(plt, enteringNavbarEle);
48 this.add(enteringNavBar);
49 var /** @type {?} */ 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 // setup leaving view
60 if (leavingView && backDirection) {
61 // leaving content
62 this.duration(opts.duration || 200).easing('cubic-bezier(0.47,0,0.745,0.715)');
63 var /** @type {?} */ 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));
69export { MDTransition };
70//# sourceMappingURL=transition-md.js.map
\No newline at end of file