Skip to content
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
48 changes: 48 additions & 0 deletions examples/HFlowField/HFlowField_001/HFlowField_001.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import hype.*;
import hype.extended.behavior.HFlowField;
import hype.extended.colorist.HColorPool;

HDrawablePool pool;
HFlowField ff;
HCanvas canvas;
HColorPool colors;
int assets = 10;

void setup() {
size(640, 640, P2D);
H.init(this).background(#202020).use3D(false);

colors = new HColorPool(#FFFFFF, #F7F7F7, #ECECEC, #333333, #0095a8, #00616f, #FF3300, #FF6600);

canvas = new HCanvas(P2D);
H.add(canvas);

ff = new HFlowField()
.debug(true)
.resolution(30)
.rotateTarget(true)
;

pool = new HDrawablePool(assets)
.autoParent(canvas)
.add(new HRect(5,25).rounding(4))
.onCreate(
new HCallback() {
public void run(Object obj) {
HDrawable d = (HDrawable) obj;
d.fill( colors.getColor());
d.noStroke();
d.anchorAt(H.CENTER);
d.loc((int) random(canvas.width()), (int) random(canvas.height()));
ff.addParticle(d);
}
}
)
.requestAll()
;
}


void draw() {
H.drawStage();
}
53 changes: 53 additions & 0 deletions examples/HFlowField/HFlowField_002/HFlowField_002.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//click the mouse...

import hype.*;
import hype.extended.behavior.HFlowField;
import hype.extended.colorist.HColorPool;

HDrawablePool pool;
HFlowField ff;
HCanvas canvas;
HColorPool colors;
int assets = 25;

void setup() {
size(640, 640, P2D);
H.init(this).background(#202020).use3D(false);

colors = new HColorPool(#FFFFFF, #F7F7F7, #ECECEC, #333333, #0095a8, #00616f, #FF3300, #FF6600);

canvas = new HCanvas(P2D).fade(300);
H.add(canvas);

ff = new HFlowField()
.debug(true)
.resolution(30)
.rotateTarget(true);

pool = new HDrawablePool(assets)
.autoParent(canvas)
.add(new HRect(5,25).rounding(4))
.onCreate(
new HCallback() {
public void run(Object obj) {
HDrawable d = (HDrawable) obj;
d.fill( colors.getColor());
d.noStroke();
d.anchorAt(H.CENTER);
d.loc((int) random(canvas.width()), (int) random(canvas.height()));
ff.addParticle(d);
}
}
)
.requestAll()
;
}


void draw() {
H.drawStage();
}

void mouseClicked(){
ff.reseed();
}
47 changes: 47 additions & 0 deletions examples/HFlowField/HFlowField_003/HFlowField_003.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import hype.*;
import hype.extended.behavior.HFlowField;
import hype.extended.colorist.HColorPool;

HDrawablePool pool;
HFlowField ff;
HCanvas canvas;
HColorPool colors;
int assets = 50;

void setup() {
size(640, 640, P2D);
H.init(this).background(#202020).use3D(false);

colors = new HColorPool(#FFFFFF, #F7F7F7, #ECECEC, #333333, #0095a8, #00616f, #FF3300, #FF6600);

canvas = new HCanvas(P2D).fade(3);
H.add(canvas);

ff = new HFlowField()
.debug(true)
.resolution(30)
.rotateTarget(true)
.noise3D(true);

pool = new HDrawablePool(assets)
.autoParent(canvas)
.add(new HRect(5,25).rounding(4))
.onCreate(
new HCallback() {
public void run(Object obj) {
HDrawable d = (HDrawable) obj;
d.fill( colors.getColor());
d.noStroke();
d.anchorAt(H.CENTER);
d.loc((int) random(canvas.width()), (int) random(canvas.height()));
ff.addParticle(d);
}
}
)
.requestAll()
;
}

void draw() {
H.drawStage();
}
64 changes: 64 additions & 0 deletions examples/HFlowField/HFlowField_004/HFlowField_004.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//press the mouse...
import hype.*;
import hype.extended.behavior.HFlowField;
import hype.extended.colorist.HColorPool;
import hype.extended.behavior.HOscillator;

HDrawablePool pool;
HFlowField ff;
HCanvas canvas;
HColorPool colors;
int assets = 100;
boolean show=true;

void setup() {
size(640, 640, P2D);
H.init(this).background(#202020);

colors = new HColorPool(#FFFFFF, #F7F7F7, #ECECEC, #333333, #0095a8, #00616f, #FF3300, #FF6600);

canvas = new HCanvas(P2D).fade(0);
H.add(canvas);

ff = new HFlowField()
.debug(show)
.resolution(8)
.rotateTarget(true)
.noise3D(true)
.forceLow(9.5F)
.forceHigh(12.9F)
.speedLow(1.5F)
.speedHigh(2.82F);

pool = new HDrawablePool(assets);
pool.autoParent(canvas)
.add(new HEllipse())
.onCreate(
new HCallback() {
public void run(Object obj) {
int i = pool.currentIndex();
HDrawable d = (HDrawable) obj;
d.fill( colors.getColor());
d.noStroke();
d.anchorAt(H.CENTER);
d.size((i*3)%5);
d.loc((int) random(canvas.width()), (int) random(canvas.height()));
ff.addParticle(d);
new HOscillator().target(d).property(H.SCALE).waveform(H.SINE).speed(2).freq(.7F).range(-1,6).currentStep(i*3);
}
}
)
.requestAll()
;
}

void draw() {
H.drawStage();
}

void mouseClicked() {
show = ! show;
ff.debug(show);
}


56 changes: 56 additions & 0 deletions examples/HFlowField/HFlowField_005/HFlowField_005.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import hype.*;
import hype.extended.behavior.HFlowField;
import hype.extended.colorist.HColorPool;
import hype.extended.behavior.HOscillator;
import hype.extended.behavior.HGradientCycle;

HDrawablePool pool;
HFlowField ff;
HCanvas canvas;
HColorPool colors;
HGradientCycle gradient;
int assets = 90;

void setup() {
size(640,640,P2D);
H.init(this).background(#242424);

colors = new HColorPool(#F7F7F7, #ECECEC, #333333, #0095a8, #00616f, #FF3300, #FF6600);
gradient = new HGradientCycle(colors);
canvas = new HCanvas(P2D).fade(0);
H.add(canvas);

ff = new HFlowField()
.debug(false)
.resolution(16)
.rotateTarget(true)
.noise3D(true)
.speedLow(1.5F)
.speedHigh(2.82F);

pool = new HDrawablePool(assets);

pool.autoParent(canvas)
.add(new HEllipse())
.onCreate(
new HCallback() {
public void run(Object obj) {
int i = pool.currentIndex()+1;
HDrawable d = (HDrawable) obj;
d.noStroke();
d.size(1+((i*2)%5));
d.loc((int)random(canvas.height()), (int) random(canvas.height()));
ff.addParticle(d);
gradient.addTarget(d).xStep(i*8).yStep(i*64).fillOnly();
}
}
)
.requestAll()
;
}

void draw() {
H.drawStage();
}


Loading