Created
February 19, 2024 19:35
-
-
Save echophon/2ebd0598f137ea02b82637d3fb583a4b to your computer and use it in GitHub Desktop.
WIP HDrawablePool - no drawstage
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
import hype.*; | |
int numAssets = 120; | |
HDrawablePool pool; | |
HRect base; | |
void setup(){ | |
size(640,640,P3D); | |
background(#242424); | |
H.init(this).use3D(true); | |
base = new HRect(0,0); | |
base.loc(width/2, height/2); | |
pool = new HDrawablePool(numAssets); | |
pool.autoParent(base) | |
.add(new HBox().size(10)) | |
.onCreate( | |
new HCallback() { | |
public void run(Object obj) { | |
HDrawable d = (HDrawable) obj; | |
d | |
.strokeWeight(1) | |
.stroke(#999999) | |
.fill(#202020) | |
.loc( (int)random(-100,100), (int)random(-100,100), (int)random(-100,100) ) | |
.anchor(random(-50,50), random(-50,50)) | |
; | |
} | |
} | |
) | |
.requestAll(); | |
} | |
void draw() { | |
background(#242424); | |
for (HDrawable d : pool){ | |
d.rotateX(frameCount*0.001); | |
d.rotateY(frameCount*-0.001); | |
} | |
base.rotateY(frameCount*0.0001); | |
base.rotateX(frameCount*-0.0001); | |
base.draw(this.g); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment