index.js 947 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. Component({
  2. behaviors: [require('../common/share-behavior').default],
  3. properties: {},
  4. data: {
  5. loaded: false,
  6. arReady: false,
  7. },
  8. lifetimes: {
  9. async attached() {
  10. console.log('data', this.data);
  11. }
  12. },
  13. methods: {
  14. handleReady: function ({detail}) {
  15. const xrScene = this.scene = detail.value;
  16. console.log('xr-scene', xrScene);
  17. },
  18. handleAssetsProgress: function ({detail}) {
  19. console.log('assets progress', detail.value);
  20. },
  21. handleAssetsLoaded: function ({detail}) {
  22. console.log('assets loaded', detail.value);
  23. this.setData({
  24. loaded: true
  25. });
  26. },
  27. handleTrackerSwitch: function ({detail}) {
  28. const active = detail.value;
  29. console.log('handleTrackerSwitch', detail);
  30. const video = this.scene.assets.getAsset('video-texture', 'hikari');
  31. if (active) {
  32. video.play();
  33. } else {
  34. video.stop();
  35. }
  36. }
  37. }
  38. })