Using the Array of Objects Resource with unique objects

I did these changes below to the sketch: :innocent:

  • Added frameRate(5);
  • Changed for (var i=0; i<50; i++) { to for (let i = 0; i < 5; ++i) {
  • Inside Jitter::carrotDraw(), changed translate(width/2, height/2) to translate(this.x, this.y)
  • And finally:
for (let i = 0; i < 360; i++) {
  this.x = cos(i - 90) * 80 * noise((frameCount * 100 + i) * 0.008)
  this.y = sin(i - 90) * 120;
  vertex(this.x, this.y)
}

to:

for (let i = 0; i < 360; i++){
  const x = cos(i - 90) * 80 * noise((frameCount * 100 + i) * 0.008)
  const y = sin(i - 90) * 120;
  vertex(x, y)
}
3 Likes