xxxxxxxxxx
84
let v = 0
let seed
let seeds = []
function setup(){
createCanvas(1000,1000);
background(51)
for (y = 0; y <= 4; y++) {
//start a new row by shifting down by 100px
//translate(0, 100)
//for (x = 0; x <= width; x = x + 10) {
//move along to the right in x by 10
let seed = new Seed();
seeds.push(seed)
}
}
function draw() {
for(let y =0; y < seeds.length; y++){
seeds[y].show();
}
}
class Seed {
constructor() {
this.angle = 0;
this.angleV = 0;
this.angleA = -0.0007;
this.v = 0;
//this.x = 100;
//this.y = 10;
//this.r = 100;
//this.endx = 20;
this.v = p5.Vector.random2D();
this.v = this.v.mult(75);
this.x = this.x + random(-5,5);
this.y = this.y + random(-5, 5);
//move() {
//this.seed.x = this.seed.x + random(70,70);
// this.seed.y = this.seed.y + random(-70, 75);
}
show() {
this.v = p5.Vector.random3D()
this.v = this.v.mult(75)
//translate(10,10);
translate(100,100);
rotate(this.angle);
stroke(200);
line(0,0,this.v.x,this.v.y);
this.endx = this.endx + 20;
//move() {
//this.seed.x = this.seed.x + random(-5,5);
// this.seed.y = this.seed.y + random(-5, 5);
//}
}
}