import hype.*;
import hype.extended.behavior.HRotate;
import hype.extended.layout.HGridLayout;
int stageW = 900;
int stageH = 900;
int bgClr = #242424;
HDrawablePool pool;
PImage gradTex1, gradTex2, gradTex3;
void settings() {
size(stageW, stageH, P3D);
fullScreen(1);
}
void setup() {
H.init(this).background(bgClr).use3D(true);
gradTex1 = loadImage("grad_001.png");
gradTex2 = loadImage("grad_002.png");
gradTex3 = loadImage("tex3b.png");
pool = new HDrawablePool(100);
pool.autoAddToStage()
.add(new HBox().texture(gradTex1))
.add(new HBox().texture(gradTex2))
.add(new HBox().texture(gradTex3))
// .add(new HSprite().texture(gradTex1))
// .add(new HSprite().texture(gradTex2))
.layout(new HGridLayout().startX(44.5).startY(44.5).spacing(90,90).cols(10))
.onCreate(
new HCallback() {
public void run(Object obj) {
HDrawable d = (HDrawable) obj;
int ranRot = 90 + ( (int)random(4)*90 );
// d.noStroke().fill(255, 225).size(178).anchorAt(H.CENTER).rotation(ranRot);
d.noStroke().fill(255, 225).size(178).rotation(ranRot).z( (int)random(-100,100) );
float ranX = random(-1.0, 1.0);
float ranY = random(-1.0, 1.0);
float ranZ = random(-1.0, 1.0);
new HRotate().target(d).speedX(ranX).speedY(ranY).speedZ(ranZ);
}
}
)
// .requestAll()
.shuffleRequestAll()
;
}
void draw() {
pushMatrix();
translate( (width/2)-(stageW/2), (height/2)-(stageH/2) );
H.drawStage();
popMatrix();
}
Comments