選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

Animation.js 737B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. if (this._options.duration) {
  18. let timer = setTimeout(() => {
  19. this._unbindEvent()
  20. this._options.callback &&
  21. this._options.callback.call(this._options.context || this)
  22. clearTimeout(timer)
  23. }, Number(this._options.duration) * 1e3)
  24. }
  25. this._bindEvent()
  26. return this
  27. }
  28. /**
  29. * Stop globe rotate
  30. * @returns {Animation}
  31. */
  32. stop() {
  33. this._unbindEvent()
  34. return this
  35. }
  36. }
  37. export default Animation