ちょっとこれ本気で欲しいな...
買おうかな。それとも、日本語版が出るのを待つか。
ちなみに、内容は以下のような感じです。
鳥の持ついろいろな要素を大胆な構成で描いた作品。美しさだけではなく、「空想」というタイトルがもつ不思議な印象が感じられる。鳥類の持つ不気味さを感じられる作品になっている。だそうです。
int l=50; int num; Qube[] qube; void setup(){ size(800,500,OPENGL); //smooth(); frameRate(30); colorMode(HSB,100); float x=l; float y=l; for(; x<width; x+=l){ for(; y<height; y+=l) ; } num = int(x*y); qube = new Qube[num]; for(int i=0; i<num; i++){ qube[i] = new Qube(l,l,l); } } void draw(){ background(99); lights(); directionalLight(99,0,99,0,0,-1); int count=0; for(float x=l; x<width; x+=l){ for(float y=l; y<height; y+=l){ pushMatrix(); translate(x,y); rotateX(frameCount*PI/60 + x); rotateY(frameCount*PI/60 + y); float h = map(x,0,width,0,100); float s = map(y,0,height,0,100); float b = 99; fill(h,s,99,60); noStroke(); qube[count].getDistance(x,y); qube[count].changeSize(); qube[count].display(); count++; popMatrix(); } } }
class Qube{ int XL; int YL; int ZL; float xl; float yl; float zl; float range = 200; float distance=0; boolean isOver = false; Qube(){ } Qube(int XL, int YL, int ZL){ this.XL = XL; this.YL = YL; this.ZL = ZL; } void display(){ box(xl,yl,zl); } void getDistance(float x,float y){ distance=sqrt(sq(mouseX-x)+sq(mouseY-y)); if(distance<range) isOver=true; else isOver=false; } void changeSize(){ if(isOver){ float s=1; xl=XL+(range-distance)*s; yl=YL+(range-distance)*s; zl=ZL+(range-distance)*s; }else{ xl=XL; yl=YL; zl=ZL; } } }
/*********************************** * * Opengl_glow.pde * ***********************************/ int STARS_NUM = 200; int CORONA_NUM = 100; float GRAVITY = 0.1; float MAX_VELOCITY = 5; Star[] stars = new Star[STARS_NUM]; Corona[] coronas = new Corona[CORONA_NUM]; void setup(){ size(800,400,OPENGL); hint( ENABLE_OPENGL_4X_SMOOTH ); background(0); PImage coronaImg=loadImage("corona.png"); for(int i=0; i<CORONA_NUM; i++){ float w=random(20,200); float h=w; Point pos = new Point(random(0+w,width-w), random(0+h,height-h)); PVector vel = new PVector(random(-2,2), random(-2,2)); coronas[i] = new Corona(coronaImg,pos,vel,w,h); } PImage starImg = loadImage("star.png"); for(int i=0; i<STARS_NUM; i++){ float w=random(1,30); if(i%23==0) w=random(70,100); float h=w; Point pos = new Point(random(0+w,width-w), random(0+h,height-h)); PVector vel = new PVector(random(-6,6), random(-6,6)); stars[i]=new Star(starImg,pos,vel,w,h); } } void draw(){ newFrame(); glUtil(); for(int i=0;i<CORONA_NUM; i++){ coronas[i].move(); coronas[i].bounce(); coronas[i].display(); } for(int i=0; i<STARS_NUM; i++){ stars[i].move(); stars[i].bounce(); stars[i].display(); } } void newFrame(){ background(0,20); }
/*********************************** * * Point.pde * ***********************************/ class Point{ float x; float y; float z; Point(){ } Point(float x,float y){ this.x = x; this.y = y; } Point(float x,float y,float z){ this(x,y); this.z = z; } }
/*********************************** * * Star.pde * ***********************************/ class Star{ PImage starImg; Point pos = new Point(); PVector vel = new PVector(); float w; float h; Star(){ } Star(PImage starImg,Point pos,PVector vel,float w,float h){ this.starImg=starImg; this.pos = pos; this.vel = vel; this.w = w; this.h = h; } void display(){ pushMatrix(); translate(0,0,pos.z); image(starImg,pos.x-w/2,pos.y-h/2,w,h); popMatrix(); } void move(){ pos.x+=random(-5,5); pos.y+=random(-5,5); pos.z+=random(-10,10); } void bounce(){ if(pos.x+w/2>width || pos.x-w/2<0){ vel.x*= -1; if(pos.x+w/2>width) pos.x=width-w/2; else pos.x=w/2; } if(pos.y+h/2>height || pos.y-h/2<0){ vel.y*= -1; if(pos.y+h/2>height) pos.y=height-h/2; else pos.y=h/2; } } }
/*********************************** * * Corona.pde * ***********************************/ class Corona extends Star{ PImage coronaImg; Corona(){ } Corona(PImage coronaImg, Point pos, PVector vel, float w, float h){ super(coronaImg, pos, vel, w, h); } }
/*********************************** * * Util.pde * ***********************************/ import processing.opengl.*; import javax.media.opengl.*; PGraphicsOpenGL pgl; GL gl; protected void glUtil() { pgl = (PGraphicsOpenGL) g; //gl = pgl.gl; //pgl.beginGL(); gl=pgl.beginGL(); gl.glDisable(GL.GL_DEPTH_TEST); // This fixes the overlap issue gl.glEnable(GL.GL_BLEND);// Turn on the blend mode gl.glBlendFunc(GL.GL_SRC_ALPHA,GL.GL_ONE); // Define the blend mode pgl.endGL(); } public void capture(char str) { if(keyPressed && key == str) { saveFrame("data/img-####.png"); } } public void vertex(PVector p) { vertex(p.x, p.y, p.z); } /** Utility for PVector class @param c1 control 1 of PVector class @param c2 control 2 of PVector class @param p point of PVector class */ public void bezierVertex(PVector c1, PVector c2, PVector p) { bezierVertex(c1.x, c1.y, c1.z, c2.x, c2.y, c2.z, p.x, p.y, p.z); } public void curveVertex(PVector p) { curveVertex(p.x, p.y, p.z); }
p_{n+1}=p_n+kp_n(1-p_n)
という漸化式でn->無限大 にしたとき係数kの値によって収束したり、しなかったりするものです。
int i;
float k,p,dk,kmin,kmax,pmin,pmax;
kmin=1.5;
kmax=3.0;
pmin=0.0;
pmax=1.5;
size(600,400);
colorMode(HSB,100);
background(10);
smooth();
dk=(kmax-kmin)/(width-1);
for(k=kmin;k<=kmax;k+=dk){
p=0.3;
for(i=1;i<=1000;i++) p+=k*p*(1-p);
for(i=1001;i<=1400;i++){
if(p>=pmin&&p<=pmax){
float Pk=map(k,kmin,kmax,0,width);
float Pp=map(p,pmin,pmax,0,height);
//stroke(99);
//point(Pk,height-Pp);
noStroke();
float r=random(0.1,1.5);
fill(random(0,20),99,99);
ellipse(Pk,height-Pp,r,r);
}
p+=k*p*(1-p);
}
}