* @param {p5.Vector|Number[]} value vector to set. * @chainable
(...args)
| 358 | * @chainable |
| 359 | */ |
| 360 | set(...args) { |
| 361 | if (args[0] instanceof Vector) { |
| 362 | this.values = args[0].values.slice(); |
| 363 | } else if (Array.isArray(args[0])) { |
| 364 | this.values = args[0].map(arg => arg || 0); |
| 365 | } else { |
| 366 | this.values = args.map(arg => arg || 0); |
| 367 | } |
| 368 | return this; |
| 369 | } |
| 370 | |
| 371 | /** |
| 372 | * Returns a copy of the <a href="#/p5.Vector">p5.Vector</a> object. |