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

ios-lift-animator.js 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 IOSLiftNavigatorAnimator = function (_NavigatorAnimator) {
  26. _inherits(IOSLiftNavigatorAnimator, _NavigatorAnimator);
  27. function IOSLiftNavigatorAnimator() {
  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 : _ref$delay,
  33. _ref$duration = _ref.duration,
  34. duration = _ref$duration === undefined ? 0.4 : _ref$duration;
  35. _classCallCheck(this, IOSLiftNavigatorAnimator);
  36. var _this = _possibleConstructorReturn(this, (IOSLiftNavigatorAnimator.__proto__ || _Object$getPrototypeOf(IOSLiftNavigatorAnimator)).call(this, { timing: timing, delay: delay, duration: duration }));
  37. _this.backgroundMask = util.createElement('<div style="position: absolute; width: 100%; height: 100%;' + 'background: linear-gradient(black, white);"></div>');
  38. return _this;
  39. }
  40. /**
  41. * @param {Object} enterPage
  42. * @param {Object} leavePage
  43. * @param {Function} callback
  44. */
  45. _createClass(IOSLiftNavigatorAnimator, [{
  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(IOSLiftNavigatorAnimator.prototype.__proto__ || _Object$getPrototypeOf(IOSLiftNavigatorAnimator.prototype), 'block', this).call(this, enterPage);
  52. animit.runAll(animit(enterPage, this.def).default({ transform: 'translate3D(0, 100%, 0)' }, { transform: 'translate3D(0, 0, 0)' }), animit(leavePage, this.def).default({ transform: 'translate3D(0, 0, 0)', opacity: 1 }, { transform: 'translate3D(0, -10%, 0)', opacity: .9 }).queue(function (done) {
  53. _this2.backgroundMask.remove();
  54. unblock();
  55. callback();
  56. done();
  57. }));
  58. }
  59. /**
  60. * @param {Object} enterPage
  61. * @param {Object} leavePage
  62. * @param {Function} callback
  63. */
  64. }, {
  65. key: 'pop',
  66. value: function pop(enterPage, leavePage, callback) {
  67. var _this3 = this;
  68. this.backgroundMask.remove();
  69. enterPage.parentNode.insertBefore(this.backgroundMask, enterPage);
  70. var unblock = _get(IOSLiftNavigatorAnimator.prototype.__proto__ || _Object$getPrototypeOf(IOSLiftNavigatorAnimator.prototype), 'block', this).call(this, enterPage);
  71. animit.runAll(animit(enterPage, this.def).default({ transform: 'translate3D(0, -43px, 0)', opacity: .9 }, { transform: 'translate3D(0, 0, 0)', opacity: 1 }).queue(function (done) {
  72. _this3.backgroundMask.remove();
  73. unblock();
  74. callback();
  75. done();
  76. }), animit(leavePage, this.def).default({ transform: 'translate3D(0, 0, 0)' }, { transform: 'translate3D(0, 100%, 0)' }));
  77. }
  78. }]);
  79. return IOSLiftNavigatorAnimator;
  80. }(NavigatorAnimator);
  81. export default IOSLiftNavigatorAnimator;