Skip to content

Instantly share code, notes, and snippets.

@echophon
Created July 2, 2014 06:51
Show Gist options
  • Save echophon/aca75da07aadc5990de7 to your computer and use it in GitHub Desktop.
Save echophon/aca75da07aadc5990de7 to your computer and use it in GitHub Desktop.
/*
Gyre Undulation - Yancy Way 2014
Requires HYPE.pde
Requires HOrbiter.pde
*/
HDrawablePool pool;
HColorPool colors;
HCanvas canvas;
void setup() {
size(500, 500);
H.init(this).background(#202020);
smooth();
canvas = new HCanvas().autoClear(true);
H.add(canvas);
colors = new HColorPool(#FFFFFF);
pool = new HDrawablePool(1440);
pool.autoParent(canvas)
.add(
new HRect(2, 2)
.rounding(2)
.anchorAt(H.CENTER)
.noStroke()
)
.onCreate(
new HCallback() {
public void run(Object obj) {
int i = pool.currentIndex();
HDrawable d = (HDrawable) obj;
// d.anchor( random(25), random(25) );
d.anchorAt(H.TOP);
d.fill(colors.getColor());
HOrbiter orbit = new HOrbiter( width/2 + cos(i) * i * 0.25, height/2 + sin(i) * i * 0.25 )
.target(d)
.speed( 1 )
.radius( 25 )
// .rotateTarget(true)
.startAngle( 0.5 * i)
;
new HOscillator().target(d).property(H.SCALE).speed(8).freq(0.5).range(0.5,2).currentStep(i * 1);
}
}
)
.requestAll()
;
}
void draw() {
H.drawStage();
if(frameCount % 2 == 0 && frameCount < 361){
saveFrame("image-#####.gif");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment