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

animator.js 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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 BaseAnimator from '../../ons/base-animator';
  20. export var AlertDialogAnimator = function (_BaseAnimator) {
  21. _inherits(AlertDialogAnimator, _BaseAnimator);
  22. function AlertDialogAnimator() {
  23. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  24. _ref$timing = _ref.timing,
  25. timing = _ref$timing === undefined ? 'linear' : _ref$timing,
  26. _ref$delay = _ref.delay,
  27. delay = _ref$delay === undefined ? 0 : _ref$delay,
  28. _ref$duration = _ref.duration,
  29. duration = _ref$duration === undefined ? 0.2 : _ref$duration;
  30. _classCallCheck(this, AlertDialogAnimator);
  31. return _possibleConstructorReturn(this, (AlertDialogAnimator.__proto__ || _Object$getPrototypeOf(AlertDialogAnimator)).call(this, { timing: timing, delay: delay, duration: duration }));
  32. }
  33. /**
  34. * @param {HTMLElement} dialog
  35. * @param {Function} done
  36. */
  37. _createClass(AlertDialogAnimator, [{
  38. key: 'show',
  39. value: function show(dialog, done) {
  40. done();
  41. }
  42. /**
  43. * @param {HTMLElement} dialog
  44. * @param {Function} done
  45. */
  46. }, {
  47. key: 'hide',
  48. value: function hide(dialog, done) {
  49. done();
  50. }
  51. }]);
  52. return AlertDialogAnimator;
  53. }(BaseAnimator);
  54. /**
  55. * Android style animator for alert dialog.
  56. */
  57. export var AndroidAlertDialogAnimator = function (_AlertDialogAnimator) {
  58. _inherits(AndroidAlertDialogAnimator, _AlertDialogAnimator);
  59. function AndroidAlertDialogAnimator() {
  60. var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  61. _ref2$timing = _ref2.timing,
  62. timing = _ref2$timing === undefined ? 'cubic-bezier(.1, .7, .4, 1)' : _ref2$timing,
  63. _ref2$duration = _ref2.duration,
  64. duration = _ref2$duration === undefined ? 0.2 : _ref2$duration,
  65. _ref2$delay = _ref2.delay,
  66. delay = _ref2$delay === undefined ? 0 : _ref2$delay;
  67. _classCallCheck(this, AndroidAlertDialogAnimator);
  68. return _possibleConstructorReturn(this, (AndroidAlertDialogAnimator.__proto__ || _Object$getPrototypeOf(AndroidAlertDialogAnimator)).call(this, { duration: duration, timing: timing, delay: delay }));
  69. }
  70. /**
  71. * @param {Object} dialog
  72. * @param {Function} callback
  73. */
  74. _createClass(AndroidAlertDialogAnimator, [{
  75. key: 'show',
  76. value: function show(dialog, callback) {
  77. callback = callback ? callback : function () {};
  78. animit.runAll(animit(dialog._mask, this.def).default({ opacity: 0 }, { opacity: 1 }), animit(dialog._dialog, this.def).default({ transform: 'translate3d(-50%, -50%, 0) scale3d(.9, .9, 1)', opacity: 0 }, { transform: 'translate3d(-50%, -50%, 0) scale3d(1, 1, 1)', opacity: 1 }).queue(function (done) {
  79. callback();
  80. done();
  81. }));
  82. }
  83. /**
  84. * @param {Object} dialog
  85. * @param {Function} callback
  86. */
  87. }, {
  88. key: 'hide',
  89. value: function hide(dialog, callback) {
  90. callback = callback ? callback : function () {};
  91. animit.runAll(animit(dialog._mask, this.def).default({ opacity: 1 }, { opacity: 0 }), animit(dialog._dialog, this.def).default({ transform: 'translate3d(-50%, -50%, 0) scale3d(1, 1, 1)', opacity: 1 }, { transform: 'translate3d(-50%, -50%, 0) scale3d(.9, .9, 1)', opacity: 0 }).queue(function (done) {
  92. callback();
  93. done();
  94. }));
  95. }
  96. }]);
  97. return AndroidAlertDialogAnimator;
  98. }(AlertDialogAnimator);
  99. /**
  100. * iOS style animator for alert dialog.
  101. */
  102. export var IOSAlertDialogAnimator = function (_AlertDialogAnimator2) {
  103. _inherits(IOSAlertDialogAnimator, _AlertDialogAnimator2);
  104. function IOSAlertDialogAnimator() {
  105. var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  106. _ref3$timing = _ref3.timing,
  107. timing = _ref3$timing === undefined ? 'cubic-bezier(.1, .7, .4, 1)' : _ref3$timing,
  108. _ref3$duration = _ref3.duration,
  109. duration = _ref3$duration === undefined ? 0.2 : _ref3$duration,
  110. _ref3$delay = _ref3.delay,
  111. delay = _ref3$delay === undefined ? 0 : _ref3$delay;
  112. _classCallCheck(this, IOSAlertDialogAnimator);
  113. return _possibleConstructorReturn(this, (IOSAlertDialogAnimator.__proto__ || _Object$getPrototypeOf(IOSAlertDialogAnimator)).call(this, { duration: duration, timing: timing, delay: delay }));
  114. }
  115. /*
  116. * @param {Object} dialog
  117. * @param {Function} callback
  118. */
  119. _createClass(IOSAlertDialogAnimator, [{
  120. key: 'show',
  121. value: function show(dialog, callback) {
  122. callback = callback ? callback : function () {};
  123. animit.runAll(animit(dialog._mask, this.def).default({ opacity: 0 }, { opacity: 1 }), animit(dialog._dialog, this.def).default({ transform: 'translate3d(-50%, -50%, 0) scale3d(1.3, 1.3, 1)', opacity: 0 }, { transform: 'translate3d(-50%, -50%, 0) scale3d(1, 1, 1)', opacity: 1 }).queue(function (done) {
  124. callback();
  125. done();
  126. }));
  127. }
  128. /**
  129. * @param {Object} dialog
  130. * @param {Function} callback
  131. */
  132. }, {
  133. key: 'hide',
  134. value: function hide(dialog, callback) {
  135. callback = callback ? callback : function () {};
  136. animit.runAll(animit(dialog._mask, this.def).default({ opacity: 1 }, { opacity: 0 }), animit(dialog._dialog, this.def).default({ opacity: 1 }, { opacity: 0 }).queue(function (done) {
  137. callback();
  138. done();
  139. }));
  140. }
  141. }]);
  142. return IOSAlertDialogAnimator;
  143. }(AlertDialogAnimator);