HOscillator 014
HYPE, HDrawablePool, HBox, HGridLayout, HOscillator (rotationX, rotationY, rotationZ), pointLight()
import hype.*;
import hype.extended.behavior.HOscillator;
import hype.extended.layout.HGridLayout;
HDrawablePool pool;
int boxSixe = 150;
void setup() {
size(640,640,P3D);
H.init(this).background(#242424).use3D(true);
pool = new HDrawablePool(100);
pool.autoAddToStage()
.add(new HBox())
.layout(new HGridLayout().startX(-125).startY(-125).spacing(100,100).cols(10))
.onCreate(
new HCallback() {
public void run(Object obj) {
int i = pool.currentIndex();
HBox d = (HBox) obj;
d.depth(boxSixe).width(boxSixe).height(boxSixe).noStroke().z(-500);
new HOscillator()
.target(d)
.property(H.ROTATIONX)
.range(-180, 180)
.speed(0.3)
.freq(1)
.currentStep(i*2)
;
new HOscillator()
.target(d)
.property(H.ROTATIONY)
.range(-180, 180)
.speed(0.3)
.freq(1)
.currentStep(i*2)
;
new HOscillator()
.target(d)
.property(H.ROTATIONZ)
.range(-360, 360)
.speed(0.5)
.freq(1)
.currentStep(i*2)
;
}
}
)
.requestAll()
;
}
void draw() {
pointLight(255, 51, 0, 0, height/2, -300); // orange
pointLight(0, 149, 168, width, height/2, -300); // teal
pointLight(255, 204, 0, width/2, height/2, -400); // yellow
H.drawStage();
}
Â