Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

md-lift-animator.js 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. * Lift screen transition.
  24. */
  25. var MDLiftNavigatorAnimator = function (_NavigatorAnimator) {
  26. _inherits(MDLiftNavigatorAnimator, _NavigatorAnimator);
  27. function MDLiftNavigatorAnimator() {
  28. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  29. _ref$timing = _ref.timing,
  30. timing = _ref$timing === undefined ? 'cubic-bezier(.1, .7, .1, 1)' : _ref$timing,
  31. _ref$delay = _ref.delay,
  32. delay = _ref$delay === undefined ? 0.05 : _ref$delay,
  33. _ref$duration = _ref.duration,
  34. duration = _ref$duration === undefined ? 0.4 : _ref$duration;
  35. _classCallCheck(this, MDLiftNavigatorAnimator);
  36. var _this = _possibleConstructorReturn(this, (MDLiftNavigatorAnimator.__proto__ || _Object$getPrototypeOf(MDLiftNavigatorAnimator)).call(this, { timing: timing, delay: delay, duration: duration }));
  37. _this.backgroundMask = util.createElement('<div style="position: absolute; width: 100%; height: 100%;' + 'background-color: black;"></div>');
  38. return _this;
  39. }
  40. /**
  41. * @param {Object} enterPage
  42. * @param {Object} leavePage
  43. * @param {Function} callback
  44. */
  45. _createClass(MDLiftNavigatorAnimator, [{
  46. key: 'push',
  47. value: function push(enterPage, leavePage, callback) {
  48. var _this2 = this;
  49. this.backgroundMask.remove();
  50. leavePage.parentNode.insertBefore(this.backgroundMask, leavePage);
  51. var unblock = _get(MDLiftNavigatorAnimator.prototype.__proto__ || _Object$getPrototypeOf(MDLiftNavigatorAnimator.prototype), 'block', this).call(this, enterPage);
  52. var maskClear = animit(this.backgroundMask).wait(this.delay + this.duration).queue(function (done) {
  53. _this2.backgroundMask.remove();
  54. done();
  55. });
  56. animit.runAll(maskClear, animit(enterPage, this.def).default({ transform: 'translate3d(0, 100%, 0)' }, { transform: 'translate3d(0, 0, 0)' }), animit(leavePage, this.def).default({ opacity: 1 }, { opacity: .4 }).queue(function (done) {
  57. unblock();
  58. callback();
  59. done();
  60. }));
  61. }
  62. /**
  63. * @param {Object} enterPage
  64. * @param {Object} leavePage
  65. * @param {Function} callback
  66. */
  67. }, {
  68. key: 'pop',
  69. value: function pop(enterPage, leavePage, callback) {
  70. var _this3 = this;
  71. this.backgroundMask.remove();
  72. enterPage.parentNode.insertBefore(this.backgroundMask, enterPage);
  73. var unblock = _get(MDLiftNavigatorAnimator.prototype.__proto__ || _Object$getPrototypeOf(MDLiftNavigatorAnimator.prototype), 'block', this).call(this, enterPage);
  74. animit.runAll(animit(this.backgroundMask).wait(this.delay + this.duration).queue(function (done) {
  75. _this3.backgroundMask.remove();
  76. done();
  77. }), animit(enterPage, this.def).default({ opacity: .4 }, { opacity: 1 }).queue(function (done) {
  78. unblock();
  79. callback();
  80. done();
  81. }), animit(leavePage, this.def).default({ transform: 'translate3d(0, 0, 0)' }, { transform: 'translate3d(0, 100%, 0)' }));
  82. }
  83. }]);
  84. return MDLiftNavigatorAnimator;
  85. }(NavigatorAnimator);
  86. export default MDLiftNavigatorAnimator;