Last active
August 29, 2015 14:02
-
-
Save echophon/e9b20ea86b818faf3fa2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Tiny Orbits | |
* by Yancy Way (Echophon) - twitter.com/echophons - echophon.tumblr.com | |
*/ | |
//requires HYPE.pde (staging) | |
//requires HOrbiter.pde | |
void setup() { | |
size(400, 400); | |
H.init(this).background(#202020); //initialize HYPE | |
smooth(); | |
//add a canvas to the stage | |
HCanvas canvas = new HCanvas().autoClear(false).fade(70); | |
H.add(canvas); | |
//create a grid of objects | |
for (int i = 0; i<30; i++){ | |
for (int j = 0; j<30; j++){ | |
//add a rectangle | |
HRect r = new HRect(3); | |
r | |
.rounding(10) | |
.anchorAt(H.CENTER) | |
.fill( #E82602 ) | |
.noStroke() | |
; | |
canvas.add(r); | |
//attach a behavior | |
HOrbiter o = new HOrbiter(i * 25 - 50 , j * 25 - 50) | |
.target(r) | |
.speed(1) | |
.radius(20) | |
.startAngle(i * 6) | |
; | |
//add a rectangle | |
HRect r2 = new HRect(3); | |
r2 | |
.anchorAt(H.CENTER) | |
.fill( #E82602 ) | |
.noStroke() | |
; | |
canvas.add(r2); | |
HOrbiter o2 = new HOrbiter() | |
.target(r2) | |
.speed(1) | |
.radius(20) | |
.rotateTarget(true) | |
.startAngle( i * 6) | |
.parent(o) //attach a behavior to the parent object | |
; | |
HRect r3 = new HRect(3); | |
r3 | |
.anchorAt(H.CENTER) | |
.fill( #E82602 ) | |
.noStroke() | |
; | |
canvas.add(r3); | |
HOrbiter o3 = new HOrbiter() | |
.target(r3) | |
.speed(1) | |
.radius(20) | |
.rotateTarget(true) | |
.startAngle( i * 6) | |
.parent(o2) | |
; | |
HRect r4 = new HRect(3); | |
r4 | |
.anchorAt(H.CENTER) | |
.fill( #E82602 ) | |
.noStroke() | |
; | |
canvas.add(r4); | |
HOrbiter o4 = new HOrbiter() | |
.target(r4) | |
.speed(1) | |
.radius(20) | |
.rotateTarget(true) | |
.startAngle( i * 6) | |
.parent(o3) | |
; | |
} | |
} | |
} | |
void draw() { | |
H.drawStage(); // draw everything on the stage | |
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