No Description

base-animator.js 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
  2. import _createClass from 'babel-runtime/helpers/createClass';
  3. /*
  4. Copyright 2013-2015 ASIAL CORPORATION
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. */
  15. import util from './util';
  16. var BaseAnimator = function () {
  17. /**
  18. * @param {Object} options
  19. * @param {String} options.timing
  20. * @param {Number} options.duration
  21. * @param {Number} options.delay
  22. */
  23. function BaseAnimator() {
  24. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  25. _classCallCheck(this, BaseAnimator);
  26. this.timing = options.timing || 'linear';
  27. this.duration = options.duration || 0;
  28. this.delay = options.delay || 0;
  29. this.def = {
  30. timing: this.timing,
  31. duration: this.duration,
  32. delay: this.delay
  33. };
  34. }
  35. _createClass(BaseAnimator, null, [{
  36. key: 'extend',
  37. value: function extend() {
  38. var properties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  39. var extendedAnimator = this;
  40. var newAnimator = function newAnimator() {
  41. extendedAnimator.apply(this, arguments);
  42. util.extend(this, properties);
  43. };
  44. newAnimator.prototype = this.prototype;
  45. return newAnimator;
  46. }
  47. }]);
  48. return BaseAnimator;
  49. }();
  50. export default BaseAnimator;