Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HOrbiter examples #157

Open
wants to merge 1 commit into
base: lib_staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions examples/HOrbiter/HOrbiter_001/HOrbiter_001.pde
Original file line number Diff line number Diff line change
@@ -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();
}
39 changes: 39 additions & 0 deletions examples/HOrbiter/HOrbiter_002/HOrbiter_002.pde
Original file line number Diff line number Diff line change
@@ -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();
}
51 changes: 51 additions & 0 deletions examples/HOrbiter/HOrbiter_003/HOrbiter_003.pde
Original file line number Diff line number Diff line change
@@ -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();
}