Nenhuma descrição

ios-fade-animator.js 3.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. var transform = 'translate3d(0, 0, 0)';
  23. /**
  24. * Fade-in screen transition.
  25. */
  26. var IOSFadeNavigatorAnimator = function (_NavigatorAnimator) {
  27. _inherits(IOSFadeNavigatorAnimator, _NavigatorAnimator);
  28. function IOSFadeNavigatorAnimator() {
  29. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  30. _ref$timing = _ref.timing,
  31. timing = _ref$timing === undefined ? 'linear' : _ref$timing,
  32. _ref$delay = _ref.delay,
  33. delay = _ref$delay === undefined ? 0 : _ref$delay,
  34. _ref$duration = _ref.duration,
  35. duration = _ref$duration === undefined ? 0.4 : _ref$duration;
  36. _classCallCheck(this, IOSFadeNavigatorAnimator);
  37. return _possibleConstructorReturn(this, (IOSFadeNavigatorAnimator.__proto__ || _Object$getPrototypeOf(IOSFadeNavigatorAnimator)).call(this, { timing: timing, delay: delay, duration: duration }));
  38. }
  39. /**
  40. * @param {Object} enterPage
  41. * @param {Object} leavePage
  42. * @param {Function} callback
  43. */
  44. _createClass(IOSFadeNavigatorAnimator, [{
  45. key: 'push',
  46. value: function push(enterPage, leavePage, callback) {
  47. var unblock = _get(IOSFadeNavigatorAnimator.prototype.__proto__ || _Object$getPrototypeOf(IOSFadeNavigatorAnimator.prototype), 'block', this).call(this, enterPage);
  48. animit.runAll(animit(enterPage, this.def).default({ transform: transform, opacity: 0 }, { transform: transform, opacity: 1 }).queue(function (done) {
  49. unblock();
  50. callback();
  51. done();
  52. }));
  53. }
  54. /**
  55. * @param {Object} enterPage
  56. * @param {Object} leavePage
  57. * @param {Function} done
  58. */
  59. }, {
  60. key: 'pop',
  61. value: function pop(enterPage, leavePage, callback) {
  62. var unblock = _get(IOSFadeNavigatorAnimator.prototype.__proto__ || _Object$getPrototypeOf(IOSFadeNavigatorAnimator.prototype), 'block', this).call(this, enterPage);
  63. animit.runAll(animit(leavePage, this.def).default({ transform: transform, opacity: 1 }, { transform: transform, opacity: 0 }).queue(function (done) {
  64. unblock();
  65. callback();
  66. done();
  67. }));
  68. }
  69. }]);
  70. return IOSFadeNavigatorAnimator;
  71. }(NavigatorAnimator);
  72. export default IOSFadeNavigatorAnimator;