@ignore
(dt)
| 120 | |
| 121 | /** @ignore */ |
| 122 | update(dt) { |
| 123 | if (this.target) { |
| 124 | const pos = this.target.pos ?? this.target; |
| 125 | this.addPoint(pos.x, pos.y); |
| 126 | } |
| 127 | |
| 128 | const pts = this._points; |
| 129 | let expired = 0; |
| 130 | for (let i = 0; i < pts.length; i++) { |
| 131 | pts[i].age += dt; |
| 132 | // oldest points are at the front, count the contiguous expired block |
| 133 | if (i === expired && pts[i].age >= this.lifetime) { |
| 134 | expired++; |
| 135 | } |
| 136 | } |
| 137 | if (expired > 0) { |
| 138 | pts.splice(0, expired); |
| 139 | } |
| 140 | |
| 141 | this.inViewport = this._points.length > 1; |
| 142 | this.isDirty = this._points.length > 1; |
| 143 | return super.update(dt); |
| 144 | } |
| 145 | |
| 146 | /** @ignore */ |
| 147 | draw(renderer) { |