From c983874d4971ca0825792ba8a68d379bcbec6263 Mon Sep 17 00:00:00 2001 From: echophon Date: Sat, 17 Feb 2024 19:49:40 -0800 Subject: [PATCH 1/3] HColorPool examples --- .../HColorPool_001/HColorPool_001.pde | 39 +++++++++++++++ .../HColorPool_002/HColorPool_002.pde | 48 +++++++++++++++++++ .../HColorPool_003/HColorPool_003.pde | 48 +++++++++++++++++++ .../HColorPool_004/HColorPool_004.pde | 41 ++++++++++++++++ 4 files changed, 176 insertions(+) create mode 100644 HYPE/examples/HColorPool/HColorPool_001/HColorPool_001.pde create mode 100644 HYPE/examples/HColorPool/HColorPool_002/HColorPool_002.pde create mode 100644 HYPE/examples/HColorPool/HColorPool_003/HColorPool_003.pde create mode 100644 HYPE/examples/HColorPool/HColorPool_004/HColorPool_004.pde diff --git a/HYPE/examples/HColorPool/HColorPool_001/HColorPool_001.pde b/HYPE/examples/HColorPool/HColorPool_001/HColorPool_001.pde new file mode 100644 index 00000000..74501d7b --- /dev/null +++ b/HYPE/examples/HColorPool/HColorPool_001/HColorPool_001.pde @@ -0,0 +1,39 @@ +import hype.*; +import hype.extended.colorist.HColorPool; +import hype.extended.behavior.HRotate; + + +int numAssets = 100; + +HRotate[] rot = new HRotate[numAssets]; +HDrawable[] d = new HDrawable[numAssets]; +HColorPool colors; +// ************************************************** + +void setup(){ + size(640,640); + background(#242424); + H.init(this); + + colors = new HColorPool(#FFFFFF, #F7F7F7, #ECECEC, #333333, #0095a8, #00616f, #FF3300, #FF6600); + + for (int i = 0; i < numAssets; ++i) { + d[i]=(i%2==0) ? new HRect().rounding(10): new HEllipse(); + d[i].noStroke(); + d[i].fill( colors.getColor() ); + d[i].loc( (int)random(width), (int)random(height) ); + d[i].anchor( new PVector(25,25) ); + d[i].size( 25+((int)random(3)*25) ); + + rot[i] = new HRotate().speed(random(-4,4)); + } +} + +void draw(){ + background(#242424); + for (int i = 0; i < numAssets; ++i) { + rot[i].run(); + d[i].rotation(rot[i].cur()).draw(this.g); + } +} + diff --git a/HYPE/examples/HColorPool/HColorPool_002/HColorPool_002.pde b/HYPE/examples/HColorPool/HColorPool_002/HColorPool_002.pde new file mode 100644 index 00000000..5410f41b --- /dev/null +++ b/HYPE/examples/HColorPool/HColorPool_002/HColorPool_002.pde @@ -0,0 +1,48 @@ +import hype.*; +import hype.extended.colorist.HColorPool; +import hype.extended.behavior.HRotate; + + +int numAssets = 100; + +HRotate[] rot = new HRotate[numAssets]; +HDrawable[] d = new HDrawable[numAssets]; +HColorPool colors; +// ************************************************** + +void setup(){ + size(640,640); + background(#242424); + H.init(this); + +// add a higher probability of white & grey by inserting more entries into the pool + colors = new HColorPool() + .add(#FFFFFF, 9) + .add(#ECECEC, 9) + .add(#CCCCCC, 9) + .add(#333333, 3) + .add(#0095a8, 2) + .add(#00616f, 2) + .add(#FF3300) + .add(#FF6600) + ; + for (int i = 0; i < numAssets; ++i) { + d[i]=(i%2==0) ? new HRect().rounding(10): new HEllipse(); + d[i].noStroke(); + d[i].fill( colors.getColor() ); + d[i].loc( (int)random(width), (int)random(height) ); + d[i].anchor( new PVector(25,25) ); + d[i].size( 25+((int)random(3)*25) ); + + rot[i] = new HRotate().speed(random(-4,4)); + } +} + +void draw(){ + background(#242424); + for (int i = 0; i < numAssets; ++i) { + rot[i].run(); + d[i].rotation(rot[i].cur()).draw(this.g); + } +} + diff --git a/HYPE/examples/HColorPool/HColorPool_003/HColorPool_003.pde b/HYPE/examples/HColorPool/HColorPool_003/HColorPool_003.pde new file mode 100644 index 00000000..9a5e9a01 --- /dev/null +++ b/HYPE/examples/HColorPool/HColorPool_003/HColorPool_003.pde @@ -0,0 +1,48 @@ +import hype.*; +import hype.extended.colorist.HColorPool; +import hype.extended.behavior.HRotate; + + +int numAssets = 100; + +HRotate[] rot = new HRotate[numAssets]; +HDrawable[] d = new HDrawable[numAssets]; +HColorPool colors; +// ************************************************** + +void setup(){ + size(640,640); + background(#242424); + H.init(this); + +// add a higher probability of white & grey by inserting more entries into the pool + colors = new HColorPool() + .add(#FFFFFF, 9) + .add(#ECECEC, 9) + .add(#CCCCCC, 9) + .add(#333333, 3) + .add(#0095a8, 2) + .add(#00616f, 2) + .add(#FF3300) + .add(#FF6600) + ; + for (int i = 0; i < numAssets; ++i) { + d[i]=(i%2==0) ? new HRect().rounding(10): new HEllipse(); + d[i].stroke(colors.getColor(), 150); + d[i].fill( colors.getColor(), 50 ); + d[i].loc( (int)random(width), (int)random(height) ); + d[i].anchor( new PVector(25,25) ); + d[i].size( 25+((int)random(3)*25) ); + + rot[i] = new HRotate().speed(random(-4,4)); + } +} + +void draw(){ + background(#242424); + for (int i = 0; i < numAssets; ++i) { + rot[i].run(); + d[i].rotation(rot[i].cur()).draw(this.g); + } +} + diff --git a/HYPE/examples/HColorPool/HColorPool_004/HColorPool_004.pde b/HYPE/examples/HColorPool/HColorPool_004/HColorPool_004.pde new file mode 100644 index 00000000..2c8f3dc5 --- /dev/null +++ b/HYPE/examples/HColorPool/HColorPool_004/HColorPool_004.pde @@ -0,0 +1,41 @@ +import hype.*; +import hype.extended.colorist.HColorPool; + +int rows = 126; +int numAssets = (rows * rows); + +HDrawable[] d = new HDrawable[numAssets]; +HColorPool colors; +// ************************************************** + +void setup(){ + size(640,640); + background(#242424); + H.init(this); + + colors = new HColorPool() + .add(#FFFFFF, 9) + .add(#ECECEC, 9) + .add(#CCCCCC, 9) + .add(#333333, 3) + .add(#0095a8, 2) + .add(#00616f, 2) + .add(#FF3300) + .add(#FF6600) + ; + for (int x = 0; x < rows; ++x) { + for (int y = 0; y < rows; ++y) { + d[x*y]= new HRect(5); + d[x*y].noStroke(); + d[x*y].fill( colors.getColorAt( (x + y * (int)random(3) )%colors.size()) ); + d[x*y].loc( 5 + (x*5), 5 + (y*5) ); + d[x*y].draw(this.g); + } + } +noLoop(); +} + +void draw(){ + +} + From 8791711ba3e5f77efd705b87a6d56cc853d7186e Mon Sep 17 00:00:00 2001 From: echophon Date: Mon, 19 Feb 2024 14:56:00 -0800 Subject: [PATCH 2/3] ColorPool minus stage --- .../HColorPool_004/HColorPool_004.pde | 31 ++++++++---- .../HColorPool_005/HColorPool_005.pde | 50 +++++++++++++++++++ 2 files changed, 70 insertions(+), 11 deletions(-) create mode 100644 HYPE/examples/HColorPool/HColorPool_005/HColorPool_005.pde diff --git a/HYPE/examples/HColorPool/HColorPool_004/HColorPool_004.pde b/HYPE/examples/HColorPool/HColorPool_004/HColorPool_004.pde index 2c8f3dc5..6e180e0b 100644 --- a/HYPE/examples/HColorPool/HColorPool_004/HColorPool_004.pde +++ b/HYPE/examples/HColorPool/HColorPool_004/HColorPool_004.pde @@ -1,11 +1,13 @@ import hype.*; import hype.extended.colorist.HColorPool; +import hype.extended.layout.HGridLayout; -int rows = 126; -int numAssets = (rows * rows); +int numAssets = 15876; HDrawable[] d = new HDrawable[numAssets]; HColorPool colors; +HGridLayout layout; + // ************************************************** void setup(){ @@ -13,7 +15,7 @@ void setup(){ background(#242424); H.init(this); - colors = new HColorPool() + colors = new HColorPool() .add(#FFFFFF, 9) .add(#ECECEC, 9) .add(#CCCCCC, 9) @@ -23,15 +25,22 @@ void setup(){ .add(#FF3300) .add(#FF6600) ; - for (int x = 0; x < rows; ++x) { - for (int y = 0; y < rows; ++y) { - d[x*y]= new HRect(5); - d[x*y].noStroke(); - d[x*y].fill( colors.getColorAt( (x + y * (int)random(3) )%colors.size()) ); - d[x*y].loc( 5 + (x*5), 5 + (y*5) ); - d[x*y].draw(this.g); - } + + layout = new HGridLayout() + .startX(5) + .startY(5) + .spacing(5,5) + .cols(126) + ; + + for (int i = 0; i < numAssets; ++i) { + d[i]= new HRect(5); + d[i].noStroke(); + d[i].fill( colors.getColor(i*3) ); + d[i].loc( layout.getNextPoint() ); + d[i].draw(this.g); } + noLoop(); } diff --git a/HYPE/examples/HColorPool/HColorPool_005/HColorPool_005.pde b/HYPE/examples/HColorPool/HColorPool_005/HColorPool_005.pde new file mode 100644 index 00000000..3859e378 --- /dev/null +++ b/HYPE/examples/HColorPool/HColorPool_005/HColorPool_005.pde @@ -0,0 +1,50 @@ +import hype.*; +import hype.extended.colorist.HColorPool; +import hype.extended.behavior.HRotate; + + +int numAssets = 200; + + +HRotate[] rot = new HRotate[numAssets]; +HDrawable[] d = new HDrawable[numAssets]; + +HColorPool colors; +int colorIndex = 0; +// ************************************************** + +void setup(){ + size(640,640); + background(#242424); + H.init(this); + + colors = new HColorPool(#FFFFFF, #333333, #0095a8, #FF3300); + + for (int i = 0; i < numAssets; ++i) { + d[i]=(i%2==0) ? new HRect().rounding(10): new HEllipse(); + d[i].noStroke(); + d[i].fill( colors.getColorAt(colorIndex) ); + d[i].loc( (int)random(width), (int)random(height) ); + d[i].anchor( new PVector(25,25) ); + d[i].size( 25+((int)random(3)*25) ); + + rot[i] = new HRotate().speed(random(-4,4)); + } +} + +void draw(){ + background(#242424); + for (int i = 0; i < numAssets; ++i) { + rot[i].run(); + d[i].fill( colors.getColorAt(colorIndex) ); + d[i].rotation(rot[i].cur()).draw(this.g); + } +} + +void keyPressed() { + switch (key) { + case ' ': + colorIndex = ++colorIndex%colors.size(); // press the spacebar on your keyboard to cycle through the colors + break; + } +} From 8f43ce6aa7e887df170caa4ccd4c33b1c1dfc123 Mon Sep 17 00:00:00 2001 From: echophon Date: Mon, 19 Feb 2024 16:53:10 -0800 Subject: [PATCH 3/3] HGridLayout examples, minus stage, minus pool --- .../HGridLayout_001/HGridLayout_001.pde | 32 +++++++++++ .../HGridLayout_002/HGridLayout_002.pde | 46 +++++++++++++++ .../HGridLayout_003/HGridLayout_003.pde | 57 +++++++++++++++++++ .../HGridLayout_004/HGridLayout_004.pde | 40 +++++++++++++ .../HGridLayout_005/HGridLayout_005.pde | 42 ++++++++++++++ .../HGridLayout_006/HGridLayout_006.pde | 49 ++++++++++++++++ 6 files changed, 266 insertions(+) create mode 100644 HYPE/examples/HGridLayout/HGridLayout_001/HGridLayout_001.pde create mode 100644 HYPE/examples/HGridLayout/HGridLayout_002/HGridLayout_002.pde create mode 100644 HYPE/examples/HGridLayout/HGridLayout_003/HGridLayout_003.pde create mode 100644 HYPE/examples/HGridLayout/HGridLayout_004/HGridLayout_004.pde create mode 100644 HYPE/examples/HGridLayout/HGridLayout_005/HGridLayout_005.pde create mode 100644 HYPE/examples/HGridLayout/HGridLayout_006/HGridLayout_006.pde diff --git a/HYPE/examples/HGridLayout/HGridLayout_001/HGridLayout_001.pde b/HYPE/examples/HGridLayout/HGridLayout_001/HGridLayout_001.pde new file mode 100644 index 00000000..954bc04a --- /dev/null +++ b/HYPE/examples/HGridLayout/HGridLayout_001/HGridLayout_001.pde @@ -0,0 +1,32 @@ +import hype.*; +import hype.extended.layout.HGridLayout; + +int numAssets = 576; + +HGridLayout layout; +HRect[] d = new HRect[numAssets]; + +void setup(){ + size(640,640); + background(#242424); + H.init(this); + + layout = new HGridLayout() + .startX(21) + .startY(21) + .spacing(26,26) + .cols(24); + + for (int i = 0; i < numAssets; ++i){ + d[i] = new HRect(25).rounding(4); + d[i].noStroke().fill(#ECECEC).anchorAt(H.CENTER); + d[i].loc( layout.getNextPoint() ); + } +} + +void draw(){ + background(#242424); + for (int i = 0; i < numAssets; ++i){ + d[i].draw(this.g); + } +} \ No newline at end of file diff --git a/HYPE/examples/HGridLayout/HGridLayout_002/HGridLayout_002.pde b/HYPE/examples/HGridLayout/HGridLayout_002/HGridLayout_002.pde new file mode 100644 index 00000000..9880539a --- /dev/null +++ b/HYPE/examples/HGridLayout/HGridLayout_002/HGridLayout_002.pde @@ -0,0 +1,46 @@ +import hype.*; +import hype.extended.colorist.HColorPool; +import hype.extended.layout.HGridLayout; + +int numAssets = 576; + +HGridLayout layout; +HColorPool colors; + +HRect[] d = new HRect[numAssets]; + +void setup(){ + size(640,640); + background(#242424); + H.init(this); + + colors = new HColorPool() + .add(#FFFFFF, 9) + .add(#ECECEC, 9) + .add(#CCCCCC, 9) + .add(#333333, 3) + .add(#0095a8, 2) + .add(#00616f, 2) + .add(#FF3300) + .add(#FF6600) + ; + + layout = new HGridLayout() + .startX(21) + .startY(21) + .spacing(26,26) + .cols(24); + + for (int i = 0; i < numAssets; ++i){ + d[i] = new HRect(36).rounding(4); + d[i].noStroke().fill(colors.getColor()).anchorAt(H.CENTER).rotation(45); + d[i].loc( layout.getNextPoint() ); + } +} + +void draw(){ + background(#242424); + for (int i = 0; i < numAssets; ++i){ + d[i].draw(this.g); + } +} \ No newline at end of file diff --git a/HYPE/examples/HGridLayout/HGridLayout_003/HGridLayout_003.pde b/HYPE/examples/HGridLayout/HGridLayout_003/HGridLayout_003.pde new file mode 100644 index 00000000..d48c2d0d --- /dev/null +++ b/HYPE/examples/HGridLayout/HGridLayout_003/HGridLayout_003.pde @@ -0,0 +1,57 @@ +import hype.*; +import hype.extended.colorist.HColorPool; +import hype.extended.layout.HGridLayout; +import hype.extended.behavior.HRotate; + + +int numAssets = 576; + +HGridLayout layout; + +HRotate[] rot = new HRotate[numAssets]; +HDrawable[] d = new HDrawable[numAssets]; +HColorPool colors; +// ************************************************** + +void setup(){ + size(640,640); + background(#242424); + H.init(this); + +// add a higher probability of white & grey by inserting more entries into the pool + colors = new HColorPool() + .add(#FFFFFF, 9) + .add(#ECECEC, 9) + .add(#CCCCCC, 9) + .add(#333333, 3) + .add(#0095a8, 2) + .add(#00616f, 2) + .add(#FF3300) + .add(#FF6600) + ; + + layout = new HGridLayout() + .startX(32) + .startY(32) + .spacing(25,25) + .cols(24) + ; + + + for (int i = 0; i < numAssets; ++i) { + d[i]=new HRect(50).rounding(4); + d[i].noStroke().fill( colors.getColor() ).alpha( (int)random(50,200) ); + d[i].anchorAt( H.CENTER ); + d[i].loc( layout.getNextPoint() ); + + rot[i] = new HRotate().speed(random(-2,2)); + } +} + +void draw(){ + background(#242424); + for (int i = 0; i < numAssets; ++i) { + rot[i].run(); + d[i].rotation(rot[i].cur()).draw(this.g); + } +} \ No newline at end of file diff --git a/HYPE/examples/HGridLayout/HGridLayout_004/HGridLayout_004.pde b/HYPE/examples/HGridLayout/HGridLayout_004/HGridLayout_004.pde new file mode 100644 index 00000000..2291b6fb --- /dev/null +++ b/HYPE/examples/HGridLayout/HGridLayout_004/HGridLayout_004.pde @@ -0,0 +1,40 @@ +import hype.*; +import hype.extended.layout.HGridLayout; + +int numAssets = 125; + +HDrawable[] d = new HDrawable[numAssets]; +HGridLayout layout; + +void setup(){ + size(640,640,P3D); + background(#242424); + H.init(this).use3D(true); + + layout = new HGridLayout() + .startX(180) + .startY(180) + .startZ(-140) + .spacing(70, 70, 70) + .cols(5) + .rows(5) + ; + + for (int i = 0; i < numAssets; ++i){ + d[i] = new HBox().depth(25).width(25).height(25); + d[i].loc( layout.getNextPoint() ); + } +} + +void draw(){ + background(#242424); + lights(); + + translate( width/2, height/2); + rotateY( map(mouseX, 0, width, -(TWO_PI/2), TWO_PI/2) ); + translate(-width/2, -height/2); + + for (int i = 0; i < numAssets; ++i){ + d[i].draw(this.g); + } +} diff --git a/HYPE/examples/HGridLayout/HGridLayout_005/HGridLayout_005.pde b/HYPE/examples/HGridLayout/HGridLayout_005/HGridLayout_005.pde new file mode 100644 index 00000000..5e9c0dea --- /dev/null +++ b/HYPE/examples/HGridLayout/HGridLayout_005/HGridLayout_005.pde @@ -0,0 +1,42 @@ +import hype.*; +import hype.extended.layout.HGridLayout; + +int numAssets = 75; + +HDrawable[] d = new HDrawable[numAssets]; +HGridLayout layout; + +void setup(){ + size(640,640,P3D); + background(#242424); + H.init(this).use3D(true); + + layout = new HGridLayout() + .startX(120) + .startY(120) + .startZ(0) + .spacing(100, 100, 50) + .cols(5) + .rows(5) + ; + + for (int i = 0; i < numAssets; ++i){ + d[i] = new HBox().depth(50).width(50).height(50); + d[i].loc( layout.getNextPoint() ); + if (d[i].z() > 0) d[i].fill(#FF6600); + if (d[i].z() > 50) d[i].fill(#EEBB00); + } +} + +void draw(){ + background(#242424); + lights(); + + translate( width/2, height/2); + rotateY( map(mouseX, 0, width, -(TWO_PI/2), TWO_PI/2) ); + translate(-width/2, -height/2); + + for (int i = 0; i < numAssets; ++i){ + d[i].draw(this.g); + } +} diff --git a/HYPE/examples/HGridLayout/HGridLayout_006/HGridLayout_006.pde b/HYPE/examples/HGridLayout/HGridLayout_006/HGridLayout_006.pde new file mode 100644 index 00000000..3ed0fe7a --- /dev/null +++ b/HYPE/examples/HGridLayout/HGridLayout_006/HGridLayout_006.pde @@ -0,0 +1,49 @@ +import hype.*; +import hype.extended.layout.HGridLayout; +import hype.extended.behavior.HOscillator; + +int numAssets = 125; + +HBox[] d = new HBox[numAssets]; +HGridLayout layout; + +HOscillator osc; + +float scale = 0; +float r = 0; + +void setup(){ + size(640,640,P3D); + background(#242424); + H.init(this).use3D(true); + + osc = new HOscillator().range(0.2, 2.5).speed(10).freq(2); + + layout = new HGridLayout().startX(180).startY(180).startZ(-140).spacing(70, 70, 70).cols(5).rows(5); + + for (int i = 0; i < numAssets; ++i){ + d[i] = new HBox().depth(25); + d[i].width(25).height(25); + d[i].loc( layout.getNextPoint() ); + } +} + +void draw(){ + background(#242424); + lights(); + + translate( width/2, height/2); + rotateY( radians(r) ); + translate(-width/2, -height/2); + r += 0.3; + + for (int i = 0; i < numAssets; ++i){ + osc.currentStep(frameCount + i *3).nextRaw(); + scale = osc.curr(); + + HBox b = (HBox) d[i]; + b.depth(25 * scale); + b.width(25 * scale).height(25 * scale); + b.draw(this.g); + } +}