index.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. Component({
  2. behaviors: [require('../common/share-behavior').default],
  3. properties: {
  4. capacity: {
  5. type: Number,
  6. value: 20
  7. },
  8. emitRate: {
  9. type: Number,
  10. value: 5
  11. },
  12. lifeTime: {
  13. type: Number,
  14. value: 3
  15. }
  16. },
  17. data: {
  18. loaded: false
  19. },
  20. lifetimes: {},
  21. methods: {
  22. handleReady({
  23. detail
  24. }) {
  25. const xrScene = this.scene = detail.value;
  26. console.log('xr-scene', xrScene);
  27. const xrFrameSystem = wx.getXrFrameSystem()
  28. //orb vfx
  29. const orb = xrScene.getElementById("orb");
  30. var tempSystem = orb.getComponent(xrFrameSystem.Particle);
  31. tempSystem.addAlphaGradient(0, 0, 0);
  32. tempSystem.addAlphaGradient(0.5, 1, 1);
  33. tempSystem.addAlphaGradient(1, 0, 0);
  34. tempSystem.addSizeGradient(0, 1, 1);
  35. tempSystem.addSizeGradient(1, 0, 0);
  36. //orbline vfx
  37. const orbLine = xrScene.getElementById("orbLine");
  38. tempSystem = orbLine.getComponent(xrFrameSystem.Particle);
  39. tempSystem.addColorGradient(0, xrFrameSystem.Vector4.createFromNumber(1, 1, 0, 1));
  40. tempSystem.addColorGradient(1, xrFrameSystem.Vector4.createFromNumber(1, 0.68, 0, 1));
  41. tempSystem.addAlphaGradient(0, 0, 0);
  42. tempSystem.addAlphaGradient(0.5, 1, 1);
  43. tempSystem.addAlphaGradient(1, 0, 0);
  44. tempSystem.addSizeGradient(0, 1, 1);
  45. tempSystem.addSizeGradient(1, 0, 0);
  46. },
  47. handleAssetsProgress: function ({
  48. detail
  49. }) {
  50. console.log('assets progress', detail.value);
  51. },
  52. handleAssetsLoaded: function ({
  53. detail
  54. }) {
  55. console.log('assets loaded', detail.value);
  56. this.setData({
  57. loaded: true
  58. });
  59. }
  60. }
  61. })