From b768df7091ee9e4b3d5e5e97dbef9289736fba20 Mon Sep 17 00:00:00 2001 From: DonoG Date: Mon, 24 Sep 2018 23:02:10 +1000 Subject: [PATCH] Add files via upload --- .../HOrbiter/HOrbiter_001/HOrbiter_001.pde | 24 +++++++++ .../HOrbiter/HOrbiter_002/HOrbiter_002.pde | 39 ++++++++++++++ .../HOrbiter/HOrbiter_003/HOrbiter_003.pde | 51 +++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 examples/HOrbiter/HOrbiter_001/HOrbiter_001.pde create mode 100644 examples/HOrbiter/HOrbiter_002/HOrbiter_002.pde create mode 100644 examples/HOrbiter/HOrbiter_003/HOrbiter_003.pde 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