-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3e99283
Showing
13 changed files
with
1,525 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
|
||
class MetaMetaMalevich extends Composition { | ||
|
||
Line[] lines; | ||
float currentAngle = 0; | ||
float angleOffset = 0; | ||
float startAngle = 0; | ||
float diameter = 0; | ||
float pAngle = 0; | ||
boolean setNewAngleOffset = true; | ||
|
||
MetaMetaMalevich() { | ||
lines = new Line[9]; | ||
for (int i = 0; i < lines.length; i++) { | ||
lines[i] = new Line(); | ||
} | ||
} | ||
|
||
void compose() { | ||
for (int i = 0; i < lines.length; i++) { | ||
lines[i].compose(); | ||
} | ||
} | ||
|
||
void display() { | ||
background(255); | ||
|
||
int halfWidth = width/2; | ||
int halfHeight = height/2; | ||
|
||
if (captured) { | ||
if (setNewAngleOffset) { | ||
startAngle = atan2(y - halfHeight, x - halfWidth); | ||
setNewAngleOffset = false; | ||
} | ||
} | ||
else { | ||
setNewAngleOffset = true; | ||
} | ||
|
||
if (dragging) { | ||
currentAngle = atan2(y - halfHeight, x - halfWidth); | ||
angleOffset += currentAngle - pAngle; | ||
pAngle = currentAngle; | ||
diameter = dist(halfWidth, halfHeight, x, y)*2; | ||
} | ||
|
||
for (int i = 0; i < lines.length; i++) { | ||
lines[i].display(angleOffset); | ||
} | ||
|
||
|
||
} | ||
} | ||
|
||
|
||
class Line { | ||
float angle; | ||
float captureAngle = 0; | ||
float length; | ||
float x; | ||
float y; | ||
float pivot; | ||
float weight; | ||
color colorVal; | ||
float speed; | ||
float screenDiagonal; | ||
|
||
Line() { | ||
compose(); | ||
} | ||
|
||
void compose() { | ||
screenDiagonal = dist(0, 0, width, height); | ||
angle = random(TWO_PI); | ||
length = random(screenDiagonal*0.05, screenDiagonal*0.7); | ||
x = random(width*0.2, width-width*0.2); | ||
y = random(height*0.2, height-height*0.2); | ||
pivot = random(-length/2, length/2); | ||
colorVal = color(176, 0, 0); | ||
weight = map(length, screenDiagonal*0.05, screenDiagonal*0.7, screenDiagonal/200, screenDiagonal/30); | ||
speed = random(0.002, 0.01); | ||
} | ||
|
||
void display(float angleOffset) { | ||
strokeWeight(weight); | ||
stroke(colorVal); | ||
strokeCap(SQUARE); | ||
pushMatrix(); | ||
translate(x, y); | ||
rotate(angle + angleOffset); | ||
line(-length/2 + pivot, 0, length/2 + pivot, 0); | ||
popMatrix(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
|
||
class Morellet60 extends Composition { | ||
|
||
float angle; | ||
float maxDimension; | ||
float division; | ||
float pixelDivision; | ||
int hashesSquareRT; | ||
|
||
MorelletHash[] hashes = new MorelletHash[400]; | ||
|
||
Morellet60() { | ||
hashesSquareRT = int(sqrt(hashes.length)); | ||
for (int i = 0; i < hashes.length; i++) { | ||
hashes[i] = new MorelletHash(i); | ||
} | ||
compose(); | ||
} | ||
|
||
void compose() { | ||
|
||
if (width > height) { | ||
maxDimension = width * 1.25; | ||
} | ||
else { | ||
maxDimension = height * 1.25; | ||
} | ||
|
||
angle = random(0, TWO_PI); | ||
|
||
division = random(hashesSquareRT/2, hashesSquareRT); | ||
pixelDivision = maxDimension / division; | ||
|
||
int xindex = 0; | ||
int yindex = 0; | ||
int index = 0; | ||
for (float x = -maxDimension/2; x < maxDimension/2; x += pixelDivision) { | ||
for (float y = -maxDimension/2; y < maxDimension/2; y += pixelDivision) { | ||
hashes[index].compose(pixelDivision, xindex, yindex); | ||
yindex++; | ||
index++; | ||
} | ||
yindex = 0; | ||
xindex++; | ||
} | ||
|
||
} | ||
|
||
void display() { | ||
background(0, 76, 126); | ||
|
||
translate(width/2, height/2); | ||
|
||
|
||
int index = 0; | ||
|
||
for (float x = -maxDimension/2; x < maxDimension/2; x += pixelDivision) { | ||
for (float y = -maxDimension/2; y < maxDimension/2; y += pixelDivision) { | ||
|
||
if (dragging) { | ||
hashes[index].adjust(); | ||
} | ||
|
||
hashes[index].display(x, y); | ||
index++; | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
class MorelletHash { | ||
|
||
float xoff; // Individual line offset | ||
float yoff; // Individual line offset | ||
float oldxoff; | ||
float oldyoff; | ||
|
||
float division; | ||
|
||
int id; | ||
float weight = 8; | ||
|
||
boolean squareHash = false; | ||
boolean halfHash = false; | ||
|
||
float angle; | ||
|
||
color colorVal; | ||
|
||
MorelletHash(int _id) { | ||
id = _id; | ||
compose(1, 0, 0); | ||
weight = dist(0, 0, width, height) / 200; | ||
angle = random(0, TWO_PI); | ||
colorVal = int(random(204, 255)); | ||
} | ||
|
||
void adjust() { | ||
xoff = oldxoff + cos(angle) * division/8; | ||
yoff = oldyoff + sin(angle) * division/8; | ||
angle += dist(mouseX, mouseY, pmouseX, pmouseY) / 60.0; | ||
} | ||
|
||
void compose(float _division, int xindex, int yindex) { | ||
|
||
squareHash = false; | ||
halfHash = false; | ||
|
||
division = _division; | ||
xoff = random(division/6, division/4); | ||
yoff = random(division/6, division/4); | ||
oldxoff = xoff; | ||
oldyoff = yoff; | ||
|
||
|
||
if (xindex % 2 == 0) { | ||
if (yindex % 2 == 0 && random(1) > 0.7) { | ||
squareHash = true; | ||
if (random(1) > 0.5) { | ||
halfHash = true; | ||
} | ||
else { | ||
halfHash = false; | ||
} | ||
} | ||
else { | ||
squareHash = false; | ||
} | ||
} | ||
else { | ||
if (yindex % 2 == 0 && random(1) > 0.7) { | ||
squareHash = false; | ||
} | ||
else { | ||
if (random(1) > 0.5) { | ||
halfHash = true; | ||
} | ||
else { | ||
halfHash = false; | ||
} | ||
squareHash = true; | ||
} | ||
} | ||
} | ||
|
||
void update(boolean capture, boolean drag, int px, int py) { | ||
} | ||
|
||
void display(float x, float y) { | ||
|
||
stroke(colorVal); | ||
strokeWeight(weight); | ||
if (squareHash) { | ||
|
||
line(x-division/2+weight/2, y-division/2, x+division/2-weight/2, y-division/2); | ||
line(x-division/2+weight/2, y, x+division/2-weight/2, y); | ||
line(x-division/2+weight/2, y+division/2, x+division/2-weight/2, y+division/2); | ||
|
||
if (halfHash) { | ||
line(x-division/2, y-division/2, x-division/2, y+division/2); | ||
line(x, y-division/2, x, y+division/2); | ||
line(x+division/2, y-division/2, x+division/2, y+division/2); | ||
} | ||
|
||
} | ||
else { | ||
line(x-xoff, y-division/2, x-xoff, y+division/2); | ||
line(x+xoff, y-division/2, x+xoff, y+division/2); | ||
line(x-division/2, y-yoff, x+division/2, y-yoff); | ||
line(x-division/2, y+yoff, x+division/2, y+yoff); | ||
} | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
|
||
class Riley61 extends Composition { | ||
|
||
float gap; | ||
float pinchX; | ||
float baseGap; | ||
float spacer; | ||
float divide = 10; | ||
|
||
float grayOff1, grayOff2, grayOff3, grayOff4; | ||
|
||
Riley61 () { | ||
compose(); | ||
} | ||
|
||
void compose() { | ||
pinchX = random(width*0.25, width*0.75); | ||
divide = random(10, 30); | ||
setGap(divide); | ||
grayOff1 = random(0, TWO_PI); | ||
grayOff2 = random(0, TWO_PI); | ||
grayOff3 = random(0, TWO_PI); | ||
grayOff4 = random(0, TWO_PI); | ||
} | ||
|
||
void setGap(float divide) { | ||
if (width >= height) { | ||
baseGap = width / divide; | ||
} | ||
else { | ||
baseGap = height / divide; | ||
} | ||
spacer = baseGap; | ||
} | ||
|
||
void display() { | ||
|
||
if (dragging) { | ||
pinchX = float(x); | ||
divide = map(mouseY, 0, height, 10, 40); | ||
setGap( divide ); | ||
} | ||
|
||
background(0); | ||
noStroke(); | ||
fill(0); | ||
|
||
float gap = 0; | ||
float angle = 0; | ||
int counter = 0; | ||
float offset = 0; | ||
float secondX = 0; | ||
int xCounter = 0; | ||
|
||
for (float y = 0; y < height + baseGap; y+= baseGap) { | ||
|
||
if (counter % 2 != 0) { | ||
offset = abs(pinchX - secondX)/2; | ||
} | ||
else { | ||
offset = 0; | ||
} | ||
xCounter = 0; | ||
|
||
// Before the pinch | ||
for (float x = pinchX-offset; x > 0-baseGap*3; x-= gap+spacer) { | ||
if (xCounter == 1) { | ||
secondX = x; | ||
} | ||
angle = map(x, 0, pinchX, 0, HALF_PI); | ||
gap = cos(angle) * (baseGap-5); | ||
float startVal = map(y, 0, height+baseGap, grayOff1, grayOff2); | ||
fill(255 - (abs(cos(startVal)) * cos(angle) * 255)); | ||
ellipse(x, y, gap + 5, baseGap); | ||
xCounter++; | ||
} | ||
|
||
// After the pinch | ||
for (float x = pinchX+offset; x < width+baseGap+baseGap; x+= gap+spacer) { | ||
angle = map(x, pinchX, width, HALF_PI, 0); | ||
gap = cos(angle) * (baseGap-5); | ||
float startVal = map(y, 0, height+baseGap, grayOff3, grayOff4); | ||
fill(255 - (abs(cos(startVal)) * cos(angle) * 255)); | ||
ellipse(x, y, gap + 5, baseGap); | ||
} | ||
|
||
counter++; | ||
} | ||
|
||
counter = 0; | ||
} | ||
} | ||
|
||
|
||
|
||
class Reily94 { | ||
} | ||
|
Oops, something went wrong.