index.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. Component({
  2. properties: {
  3. capacity: {
  4. type: Number,
  5. value: 20
  6. },
  7. emitRate: {
  8. type: Number,
  9. value: 5
  10. },
  11. lifeTime:{
  12. type: Number,
  13. value: 3
  14. }
  15. },
  16. data: {
  17. loaded: false
  18. },
  19. lifetimes: {},
  20. methods: {
  21. handleReady({detail}) {
  22. const xrScene = this.scene = detail.value;
  23. console.log('xr-scene', xrScene);
  24. const xrFrameSystem = wx.getXrFrameSystem()
  25. //orb vfx
  26. const orb = xrScene.getElementById("orb");
  27. var tempSystem = orb.getComponent('custom-particle');
  28. tempSystem.addAlphaGradient(0, 0, 0);
  29. tempSystem.addAlphaGradient(0.5, 1, 1);
  30. tempSystem.addAlphaGradient(1, 0, 0);
  31. tempSystem.addSizeGradient(0, 1, 1);
  32. tempSystem.addSizeGradient(1, 0, 0);
  33. //orbline vfx
  34. const orbLine = xrScene.getElementById("orbLine");
  35. tempSystem = orbLine.getComponent('custom-particle');
  36. tempSystem.addColorGradient(0, xrFrameSystem.Vector4.createFromNumber(1, 1, 0, 1));
  37. tempSystem.addColorGradient(1, xrFrameSystem.Vector4.createFromNumber(1, 0.68, 0, 1));
  38. tempSystem.addAlphaGradient(0, 0, 0);
  39. tempSystem.addAlphaGradient(0.5, 1, 1);
  40. tempSystem.addAlphaGradient(1, 0, 0);
  41. tempSystem.addSizeGradient(0, 1, 1);
  42. tempSystem.addSizeGradient(1, 0, 0);
  43. },
  44. handleAssetsProgress: function({detail}) {
  45. console.log('assets progress', detail.value);
  46. },
  47. }
  48. })