If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Course: Unlisted resources area > Unit 2

Lesson 1: ProcessingJS documentation

PVector.add(vector)

Adds components to a vector, adds one vector to another, or adds two independent vectors together. The version of the method that adds two vectors together is a static method and returns a PVector, the others have no return value — they act directly on the vector.

vector.add(x, y, z)

Parameters:
NameDescription
xthe x component
ythe y component
zthe z component

vector.add(vector2)

Parameters:
NameDescription
vector2Any PVector instance

PVector.add(vector1, vector2)

Parameters:
NameDescription
vector1Any PVector instance
vector2Any PVector instance

Want to join the conversation?

No posts yet.