UNPKG

3.29 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 {?} */ SHOW_BACK_BTN_CSS = 'show-back-button';
15var /** @type {?} */ SCALE_SMALL = .95;
16var WPTransition = (function (_super) {
17 __extends(WPTransition, _super);
18 function WPTransition() {
19 return _super !== null && _super.apply(this, arguments) || this;
20 }
21 /**
22 * @return {?}
23 */
24 WPTransition.prototype.init = function () {
25 _super.prototype.init.call(this);
26 var /** @type {?} */ plt = this.plt;
27 var /** @type {?} */ enteringView = this.enteringView;
28 var /** @type {?} */ leavingView = this.leavingView;
29 var /** @type {?} */ opts = this.opts;
30 // what direction is the transition going
31 var /** @type {?} */ backDirection = (opts.direction === 'back');
32 if (enteringView) {
33 if (backDirection) {
34 this.duration(isPresent(opts.duration) ? opts.duration : 120).easing('cubic-bezier(0.47,0,0.745,0.715)');
35 this.enteringPage.beforeClearStyles(['scale']);
36 }
37 else {
38 this.duration(isPresent(opts.duration) ? opts.duration : 280).easing('cubic-bezier(0,0,0.05,1)');
39 this.enteringPage
40 .fromTo('scale', SCALE_SMALL, 1, true)
41 .fromTo('opacity', 0.01, 1, true);
42 }
43 if (enteringView.hasNavbar()) {
44 var /** @type {?} */ enteringPageEle = enteringView.pageRef().nativeElement;
45 var /** @type {?} */ enteringNavbarEle = enteringPageEle.querySelector('ion-navbar');
46 var /** @type {?} */ enteringNavBar = new Animation(plt, enteringNavbarEle);
47 this.add(enteringNavBar);
48 var /** @type {?} */ enteringBackButton = new Animation(plt, enteringNavbarEle.querySelector('.back-button'));
49 this.add(enteringBackButton);
50 if (enteringView.enableBack()) {
51 enteringBackButton.beforeAddClass(SHOW_BACK_BTN_CSS);
52 }
53 else {
54 enteringBackButton.beforeRemoveClass(SHOW_BACK_BTN_CSS);
55 }
56 }
57 }
58 // setup leaving view
59 if (leavingView && backDirection) {
60 // leaving content
61 this.duration(opts.duration || 200).easing('cubic-bezier(0.47,0,0.745,0.715)');
62 var /** @type {?} */ leavingPage = new Animation(plt, leavingView.pageRef());
63 this.add(leavingPage.fromTo('scale', 1, SCALE_SMALL).fromTo('opacity', 0.99, 0));
64 }
65 };
66 return WPTransition;
67}(PageTransition));
68export { WPTransition };
69//# sourceMappingURL=transition-wp.js.map
\No newline at end of file