No Description

md-fade-animator.js 3.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import _Object$getPrototypeOf from 'babel-runtime/core-js/object/get-prototype-of';
  2. import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
  3. import _createClass from 'babel-runtime/helpers/createClass';
  4. import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
  5. import _get from 'babel-runtime/helpers/get';
  6. import _inherits from 'babel-runtime/helpers/inherits';
  7. /*
  8. Copyright 2013-2015 ASIAL CORPORATION
  9. Licensed under the Apache License, Version 2.0 (the "License");
  10. you may not use this file except in compliance with the License.
  11. You may obtain a copy of the License at
  12. http://www.apache.org/licenses/LICENSE-2.0
  13. Unless required by applicable law or agreed to in writing, software
  14. distributed under the License is distributed on an "AS IS" BASIS,
  15. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. See the License for the specific language governing permissions and
  17. limitations under the License.
  18. */
  19. import NavigatorAnimator from './animator';
  20. import util from '../../ons/util';
  21. import animit from '../../ons/animit';
  22. /**
  23. * Fade-in + Lift screen transition.
  24. */
  25. var MDFadeNavigatorAnimator = function (_NavigatorAnimator) {
  26. _inherits(MDFadeNavigatorAnimator, _NavigatorAnimator);
  27. function MDFadeNavigatorAnimator() {
  28. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  29. _ref$timing = _ref.timing,
  30. timing = _ref$timing === undefined ? 'cubic-bezier(0.4, 0, 0.2, 1)' : _ref$timing,
  31. _ref$timingPop = _ref.timingPop,
  32. timingPop = _ref$timingPop === undefined ? 'cubic-bezier(0.4, 0, 1, 1)' : _ref$timingPop,
  33. _ref$delay = _ref.delay,
  34. delay = _ref$delay === undefined ? 0 : _ref$delay,
  35. _ref$duration = _ref.duration,
  36. duration = _ref$duration === undefined ? 0.2 : _ref$duration;
  37. _classCallCheck(this, MDFadeNavigatorAnimator);
  38. var _this = _possibleConstructorReturn(this, (MDFadeNavigatorAnimator.__proto__ || _Object$getPrototypeOf(MDFadeNavigatorAnimator)).call(this, { timing: timing, delay: delay, duration: duration }));
  39. _this.timingPop = timingPop;
  40. return _this;
  41. }
  42. /**
  43. * @param {Object} enterPage
  44. * @param {Object} leavePage
  45. * @param {Function} callback
  46. */
  47. _createClass(MDFadeNavigatorAnimator, [{
  48. key: 'push',
  49. value: function push(enterPage, leavePage, callback) {
  50. var unblock = _get(MDFadeNavigatorAnimator.prototype.__proto__ || _Object$getPrototypeOf(MDFadeNavigatorAnimator.prototype), 'block', this).call(this, enterPage);
  51. animit.runAll(animit(enterPage, this.def).default({ transform: 'translate3D(0, 42px, 0)', opacity: 0 }, { transform: 'translate3D(0, 0, 0)', opacity: 1 }).queue(function (done) {
  52. unblock();
  53. callback();
  54. done();
  55. }));
  56. }
  57. /**
  58. * @param {Object} enterPage
  59. * @param {Object} leavePage
  60. * @param {Function} done
  61. */
  62. }, {
  63. key: 'pop',
  64. value: function pop(enterPage, leavePage, callback) {
  65. var unblock = _get(MDFadeNavigatorAnimator.prototype.__proto__ || _Object$getPrototypeOf(MDFadeNavigatorAnimator.prototype), 'block', this).call(this, enterPage);
  66. animit.runAll(animit(leavePage, this.def).default({ transform: 'translate3D(0, 0, 0)', opacity: 1 }, { css: { transform: 'translate3D(0, 38px, 0)', opacity: 0 }, timing: this.timingPop }).queue(function (done) {
  67. unblock();
  68. callback();
  69. done();
  70. }));
  71. }
  72. }]);
  73. return MDFadeNavigatorAnimator;
  74. }(NavigatorAnimator);
  75. export default MDFadeNavigatorAnimator;