p5.Vector

post image

vectors, vectors, vectors! like a wood cutting directions or not.

syntax

new p5.Vector([x], [y], [z]);

add

a => (3, 4)

b => (2, -1)

a + b => (5, 3)

class Woodencode {
  constructor(x, y) {
    this.a = createVector(3, 4);
    this.b = createVector(2, 1);
  }
  
  update() {
    // a.add(b); 
    this.a.add(this.b);
  }