createVector()

Creates a 2D or 3D Geometric vector from coordinates

Example

point = createVector(200, 100)
circle(point.x, point.y,mouseX )

Syntax

createVector([x], [y], [z])
InputDescription

x

horizontal component of the vector

y

vertical component of the vector

z(optional)

depth component of the vector (in case of 3D)

Description

The createVector() function is used to create a 2D or 3D vector, which is essentially an object with x, y, and optionally z properties that represent a magnitude and direction in space.

Once you have created a vector using the createVector() function, you can access its components using the x, y, and z properties.

Find these documents helpful? Let the people who made them help your child learn to code at Strivemath!

We'd love to hear your Feedback/Comments here.

Last updated