Hi people, I want ths image to be drawn by the forms i created. So they all will start at one point and then expand to all directions. The PVector function gives me the curvature i like them to have while i’m hoping the For loop option and the rotate transformation will make the particle to expand towards the whole sketch.I know there’s an issue with the two last ones but im not sure where to put it.What would you recommend me to do?
Particle[] particles;
PImage frog;
void setup() {
size(858, 536,P2D);
frog = loadImage("frog.jpg");
particles = new Particle [700];
for (int i = 0; i < particles.length; i++) {
particles[i] = new Particle();
}
background(0);
}
void draw() {
translate(width/2, height/2);
for (int i = 0; i < particles.length; i++) {
//for (int e = 0; e < 5; e++) {
pushMatrix();
rotate(i);
particles[i].display();
particles[i].move();
popMatrix();
}
}
Here’s my class
class Particle {
PVector location;
PVector velocity;
PVector acceleration;
Particle() {
location = new PVector(0,0);
velocity = new PVector(random(0,3),random(0,3));
acceleration = new PVector(random(0.02),0);
}
void display() {
noStroke();
color c = frog.get(int(location.x),int(location.y));
fill(c,25);
ellipse(location.x, location.y, 10, 10);
}
void move() {
location.add(velocity);
velocity.add(acceleration);
}
void edges() {
if (location.y < 0) {
location.y = height;
}
if (location.y > height) {
location.y = 0;
}
if (location.x < 0) {
location.x = width;
}
if (location.x > width) {
location.x = 0;
}
}
}