No Description

overlay-animator.js 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 _inherits from 'babel-runtime/helpers/inherits';
  6. /*
  7. Copyright 2013-2015 ASIAL CORPORATION
  8. Licensed under the Apache License, Version 2.0 (the "License");
  9. you may not use this file except in compliance with the License.
  10. You may obtain a copy of the License at
  11. http://www.apache.org/licenses/LICENSE-2.0
  12. Unless required by applicable law or agreed to in writing, software
  13. distributed under the License is distributed on an "AS IS" BASIS,
  14. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. See the License for the specific language governing permissions and
  16. limitations under the License.
  17. */
  18. import animit from '../../ons/animit';
  19. import SplitterAnimator from './animator.js';
  20. var OverlaySplitterAnimator = function (_SplitterAnimator) {
  21. _inherits(OverlaySplitterAnimator, _SplitterAnimator);
  22. function OverlaySplitterAnimator() {
  23. _classCallCheck(this, OverlaySplitterAnimator);
  24. return _possibleConstructorReturn(this, (OverlaySplitterAnimator.__proto__ || _Object$getPrototypeOf(OverlaySplitterAnimator)).apply(this, arguments));
  25. }
  26. _createClass(OverlaySplitterAnimator, [{
  27. key: 'translate',
  28. value: function translate(distance) {
  29. this._mask.style.display = 'block'; // Avoid content clicks
  30. animit(this._side).queue({
  31. transform: 'translate3d(' + (this.minus + distance) + 'px, 0, 0)'
  32. }).play();
  33. }
  34. /**
  35. * @param {Function} done
  36. */
  37. }, {
  38. key: 'open',
  39. value: function open(done) {
  40. animit.runAll(animit(this._side).wait(this.delay).queue({
  41. transform: 'translate3d(' + this.minus + '100%, 0, 0)'
  42. }, this.def).queue(function (callback) {
  43. callback();
  44. done && done();
  45. }), animit(this._mask).wait(this.delay).queue({
  46. display: 'block'
  47. }).queue({
  48. opacity: '1'
  49. }, {
  50. duration: this.duration,
  51. timing: 'linear'
  52. }));
  53. }
  54. /**
  55. * @param {Function} done
  56. */
  57. }, {
  58. key: 'close',
  59. value: function close(done) {
  60. animit.runAll(animit(this._side).wait(this.delay).queue({
  61. transform: 'translate3d(0, 0, 0)'
  62. }, this.def).queue(function (callback) {
  63. done && done();
  64. callback();
  65. }), animit(this._mask).wait(this.delay).queue({
  66. opacity: '0'
  67. }, {
  68. duration: this.duration,
  69. timing: 'linear'
  70. }).queue({
  71. display: 'none'
  72. }));
  73. }
  74. }]);
  75. return OverlaySplitterAnimator;
  76. }(SplitterAnimator);
  77. export default OverlaySplitterAnimator;