1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
Particle[] particles; int num = 500; float t=0; void setup(){ size(900,600); } void draw(){ background(0); particles = new Particle[num]; float lastx = -999; float lasty = -999; for(int i=0; i<num; i++){ float radius = 200 + (100*pow(sin(float(i)/5+TWO_PI/2*noise(i+t)),70))*pow(sin(t),40) + (100*pow(sin(float(i)/5+TWO_PI/2*noise(i*t)+TWO_PI/3),100))*pow(sin(t),40) + (100*pow(sin(float(i)/5+TWO_PI/2*noise(i*t)+TWO_PI/4),100))*pow(sin(t),40) + 30*noise((i+t)*10); float theta = i*TWO_PI/num; particles[i] = new Particle(radius,theta); if(lastx >0){ stroke(255); line(particles[i].x, particles[i].y, lastx,lasty); } lastx = particles[i].x; lasty = particles[i].y; saveFrame("output/gif-"+nf(int(t*10), 3)+".png"); } t += 0.1; } class Particle{ int centx = width/2; int centy = height/2; float x,y; float radius; float angle; Particle(float radius, float angle){ x = centx+(radius)*cos(angle); y = centy+(radius)*sin(angle); } void render(){ circle(x,y,10); } } |
コメント