Reference set()

set()

Sets the the vector to a new value.

set() can use separate numbers, as in v.set(1, 2, 3), a p5.Vector object, as in v.set(v2), or an array of numbers, as in v.set([1, 2, 3]).

Examples

Syntax

set([x], [y], [z])
set(value)

Parameters

x
Number: x component of the vector.
y
Number: y component of the vector.
z
Number: z component of the vector.
value
p5.Vector|Number[]: vector to set.
Notice any errors or typos? Please let us know. Please feel free to edit src/math/p5.Vector.js and open a pull request!

Related References