test.ts 808 B

123456789101112131415161718192021222324252627282930313233
  1. import { _decorator, Component, Graphics, Node } from 'cc';
  2. const { ccclass, property } = _decorator;
  3. @ccclass('test')
  4. export class test extends Component {
  5. @property(Graphics) m_g:Graphics = null
  6. start() {
  7. // const g = this.m_g
  8. // g.lineWidth = 10;
  9. // g.fillColor.fromHEX('#ff0000');
  10. // g.moveTo(-40, 0);
  11. // g.lineTo(0, -80);
  12. // g.lineTo(40, 0);
  13. // g.lineTo(0, 80);
  14. // g.close();
  15. // g.stroke();
  16. // this.m_g.fill();
  17. const ctx = this.m_g
  18. ctx.moveTo(20,20);
  19. ctx.lineWidth = 30;
  20. ctx.fillColor.fromHEX('#ff0000');
  21. ctx.bezierCurveTo(20,100,200,100,200,20);
  22. // ctx.close();
  23. ctx.stroke();
  24. // ctx.fill();
  25. }
  26. update(deltaTime: number) {
  27. }
  28. }