index.js 756 B

12345678910111213141516171819202122232425262728293031323334353637
  1. Component({
  2. behaviors: [require('../../common/share-behavior').default],
  3. properties: {
  4. a: Number,
  5. },
  6. data: {
  7. loaded: false,
  8. words: "文本内容",
  9. fontColor: "1.0 1.0 1.0",
  10. fontSize: 1,
  11. },
  12. lifetimes: {},
  13. methods: {
  14. handleReady({detail}) {
  15. const xrScene = this.scene = detail.value;
  16. console.log('xr-scene', xrScene);
  17. let number = 0;
  18. let fontSize = 1;
  19. setInterval(()=>{
  20. this.setData({
  21. words: number,
  22. fontSize: fontSize,
  23. fontColor: `${Math.random()} ${Math.random()} ${Math.random()}`
  24. })
  25. number++;
  26. if (fontSize > 2) {
  27. fontSize = 1;
  28. } else {
  29. fontSize+= 0.1;
  30. }
  31. }, 200);
  32. }
  33. }
  34. })