Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

Animation.js 761B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * @Author: Caven
  3. * @Date: 2020-12-20 16:32:22
  4. */
  5. class Animation {
  6. constructor(viewer) {
  7. this._viewer = viewer
  8. this._options = {}
  9. }
  10. _bindEvent() {}
  11. _unbindEvent() {}
  12. /**
  13. * Start globe rotate
  14. * @returns {Animation}
  15. */
  16. start() {
  17. this._unbindEvent()
  18. if (this._options.duration) {
  19. let timer = setTimeout(() => {
  20. this._unbindEvent()
  21. this._options.callback &&
  22. this._options.callback.call(this._options.context || this)
  23. clearTimeout(timer)
  24. }, Number(this._options.duration) * 1e3)
  25. }
  26. this._bindEvent()
  27. return this
  28. }
  29. /**
  30. * Stop globe rotate
  31. * @returns {Animation}
  32. */
  33. stop() {
  34. this._unbindEvent()
  35. return this
  36. }
  37. }
  38. export default Animation