diff --git a/examples/HOrbiter/HOrbiter_001/HOrbiter_001.pde b/examples/HOrbiter/HOrbiter_001/HOrbiter_001.pde new file mode 100644 index 00000000..b9add953 --- /dev/null +++ b/examples/HOrbiter/HOrbiter_001/HOrbiter_001.pde @@ -0,0 +1,24 @@ +import hype.*; +import hype.extended.behavior.HOrbiter; + +void setup() { + size(640,640,P3D); + H.init(this).background(#242424).use3D(true); + + HRect d = new HRect(50).rounding(4); + d.noStroke().fill(#FF3300).anchorAt(H.CENTER).rotation(45); + H.add(d); + + HOrbiter orb = new HOrbiter(width/2, height/2) + .target(d) + .speed(1) + .radius(250) + ; + +H.add(new HEllipse(200).loc(width/2,height/2).anchorAt(H.CENTER)); + +} + +void draw() { + H.drawStage(); +} \ No newline at end of file diff --git a/examples/HOrbiter/HOrbiter_002/HOrbiter_002.pde b/examples/HOrbiter/HOrbiter_002/HOrbiter_002.pde new file mode 100644 index 00000000..1d5863fb --- /dev/null +++ b/examples/HOrbiter/HOrbiter_002/HOrbiter_002.pde @@ -0,0 +1,39 @@ +import hype.*; +import hype.extended.behavior.HOrbiter; +import hype.extended.colorist.HColorPool; + +HDrawablePool pool; + +void setup() { + size(640,640,P2D); + H.init(this).background(#242424).use3D(false); + + pool = new HDrawablePool(42); + pool.autoAddToStage() + .add(new HRect(50).rounding(10)) + .colorist( new HColorPool(#FFFFFF, #F7F7F7, #ECECEC, #333333, #0095a8, #00616f, #FF3300, #FF6600).fillOnly() ) + .onCreate( + new HCallback() { + public void run(Object obj) { + HDrawable d = (HDrawable) obj; + d.noStroke().anchorAt(H.CENTER).rotation(45); + + HOrbiter orb = new HOrbiter(width/2, height/2) + .target(d) + .speed(random(-1.5, 1.5)) + .radius(250) + .startAngle( (int)random(360) ) + ; + } + } + ) + .requestAll() + ; + +H.add(new HEllipse(200).loc(width/2,height/2).anchorAt(H.CENTER)); + +} + +void draw() { + H.drawStage(); +} \ No newline at end of file diff --git a/examples/HOrbiter/HOrbiter_003/HOrbiter_003.pde b/examples/HOrbiter/HOrbiter_003/HOrbiter_003.pde new file mode 100644 index 00000000..cdc9a3cc --- /dev/null +++ b/examples/HOrbiter/HOrbiter_003/HOrbiter_003.pde @@ -0,0 +1,51 @@ +//somewhat spirograph-y fun +import hype.*; +import hype.extended.behavior.HOrbiter; + +HOrbiter orb1, orb2, orb3, orb4; +HCanvas canvas; + +void setup() { + size(640, 640, P2D); + H.init(this).background(#242424); + + canvas = new HCanvas().autoClear(false); + H.add(canvas); + + HEllipse d = new HEllipse(1); + d.noStroke().fill(H.WHITE).anchorAt(H.CENTER); + canvas.add(d); + + orb1 = new HOrbiter(width/2, height/2) + .speed(1) + .radius(125) + ; + + orb2 = new HOrbiter(width/2, height/2) + .speed(2.5) + .radius(random(2, width/7.4)) + .parent(orb1) + ; + + orb3 = new HOrbiter(width/2, height/2) + .speed(.9) + .radius(random(2, (width*2)/21.4)) + .parent(orb2) + ; + + orb4 = new HOrbiter(width/2, height/2) + .target(d) + .speed(3.12) + .radius(random(2, (width/2)/10.7)) + .parent(orb2) + ; + + //radius values + println(orb2.radius()); + println(orb3.radius()); + println(orb4.radius()); +} + +void draw() { + H.drawStage(); +} \ No newline at end of file