index.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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({detail}) {
  23. const xrScene = this.scene = detail.value;
  24. console.log('xr-scene', xrScene);
  25. const xrFrameSystem = wx.getXrFrameSystem()
  26. const magicField = xrScene.getElementById("magicField");
  27. const tempSystem = magicField.getComponent(xrFrameSystem.Particle)
  28. tempSystem.addSizeGradient(0,0.7);
  29. tempSystem.addSizeGradient(0.5,1.0);
  30. tempSystem.addColorGradient(0, xrFrameSystem.Vector4.createFromNumber(1,0.89,0.27,1));
  31. tempSystem.addColorGradient(1, xrFrameSystem.Vector4.createFromNumber(1,0.64,0,1));
  32. tempSystem.addAlphaGradient(0,0,0);
  33. tempSystem.addAlphaGradient(0.5,1,1);
  34. tempSystem.addAlphaGradient(1,0,0);
  35. },
  36. handleAssetsProgress: function({detail}) {
  37. console.log('assets progress', detail.value);
  38. },
  39. handleAssetsLoaded: function({detail}) {
  40. console.log('assets loaded', detail.value);
  41. this.setData({loaded: true});
  42. }
  43. }
  44. })