MCPcopy Index your code
hub / github.com/processing/p5.js / setValue

Method setValue

src/math/p5.Vector.js:181–190  ·  view source on GitHub ↗

* Sets the value at the specified index of the vector. * * This method allows you to change a specific component of the vector by providing its index and the new value you want to set. * Think of the vector as a list of numbers, where each number represents a different direction (like x, y,

(index, value)

Source from the content-addressed store, hash-verified

179 * @throws Will throw an error if the index is outside the bounds of the vector, meaning if you try to set a value at a position that doesn't exist in the vector.
180 */
181 setValue(index, value) {
182 if (index < this.values.length) {
183 this.values[index] = value;
184 } else {
185 this._friendlyError(
186 'The index parameter is trying to set a value outside the bounds of the vector',
187 'p5.Vector.setValue'
188 );
189 }
190 }
191
192 /**
193 * Gets the y component of the vector.

Callers

nothing calls this directly

Calls 1

_friendlyErrorMethod · 0.95

Tested by

no test coverage detected