const {ccclass, property} = cc._decorator; @ccclass export default class TipLine extends cc.Component { _points: cc.Vec2[]; draw:cc.Graphics; onLoad() { this.draw=this.node.getComponent(cc.Graphics); } set points(v) { this._points=v; this.draw.clear() this.draw.moveTo(v[0].x,v[0].y) for(var i=1;i unitLenth; lineLenth -= unitLenth){ if(drawLine){ this.draw.moveTo(pos.x, pos.y); pos.addSelf(increment); this.draw.lineTo(pos.x, pos.y); this.draw.stroke(); }else{ pos.addSelf(increment); } drawLine = !drawLine; } if(drawLine){ this.draw.moveTo(pos.x, pos.y); this.draw.lineTo(endPos.x, endPos.y); this.draw.stroke(); } } this.draw.stroke(); } get points() { return this._points; } // update (dt) {} }