xxxxxxxxxx
ArrayList blades = new ArrayList();
int amount = 22;
void setup() {
size(640, 640);
noFill();
stroke(0);
float f = 360/amount;
for(int i = 0; i < amount; i++){
blades.add(new Blade(new PVector(width/2, height/2), cos(radians(i*f))));
}
}
void draw() {
background(255);
for(int i = 0; i < blades.size(); i++){
Blade b = (Blade) blades.get(i);
stroke(0, 255, 255);
b.draw(1.5);
}
for(int i = 0; i < blades.size(); i++){
Blade b = (Blade) blades.get(i);
stroke(50, 0, 50);
b.draw(0.8);
b.move();
}
}
class Blade {
PVector loc;
float dir;
Blade(PVector loc, float d) {
this.loc = loc.get();
dir = d;
}
void draw(float d) {
pushMatrix();
translate(loc.x, loc.y);
rotate(radians(frameCount*dir));
for (int i = -90; i < 90; i+=4) {
float x = i;
float y = sin(radians(i*dir))*40;
float x2 = i+4;
float y2 = sin(radians((i+4)*dir))*40;
float s = (1 - abs(map(i, -90, 90, -1, 1))) * 10;
strokeWeight(s*d);
line(x*2, y*2, x2*2, y2*2);
}
popMatrix();
}
void move() {
PVector vel = new PVector(0, 0);
loc.add(vel);
}
}