Skip to content

Instantly share code, notes, and snippets.

@georgebashi
Created January 19, 2010 15:35
Show Gist options
  • Save georgebashi/281004 to your computer and use it in GitHub Desktop.
Save georgebashi/281004 to your computer and use it in GitHub Desktop.
Valentines
import toxi.math.noise.*;
import toxi.math.waves.*;
import toxi.geom.*;
import toxi.math.*;
import toxi.math.conversion.*;
import toxi.geom.util.*;
import toxi.util.datatypes.*;
import toxi.color.*;
import toxi.color.theory.*;
private static final int NUM_NODES = 3;
void setup() {
size(1200, 1800);
smooth();
}
void draw() {
//beginRecord(PDF, "frame-####.pdf");
background(0);
noFill();
ColorList cl = ColorRange.WARM.getColors(TColor.RED, 100, 0.05f).sortByCriteria(AccessCriteria.HUE, false);
for (int i = 0; i < 12; i++) {
int[] nodeX = new int[NUM_NODES];
int[] nodeY = new int[NUM_NODES];
int lastX = (int) random(-300, width + 300);
for (int j = 0; j < nodeX.length; j++) {
lastX = nodeX[j] = lastX + (int) random(-500, 500);
}
int max_node_height = height / (NUM_NODES + 2);
for (int j = 1; j <= NUM_NODES; j++) {
int position = (int) (random(0, max_node_height) + (j * max_node_height));
nodeY[j - 1] = position;
}
for (int k = 0; k < 500; k += random(3, 8)) {
stroke(cl.get((int) (k % (int) cl.size())).toARGB());
beginShape();
curveVertex(k + nodeX[0] + random(-10, 10), 0);
curveVertex(k + nodeX[0] + random(-10, 10), 0);
for (int j = 0; j < NUM_NODES; j++) {
curveVertex(k + nodeX[j], nodeY[j]);
}
curveVertex(k + nodeX[NUM_NODES - 1] + random(-150, 150), height);
curveVertex(k + nodeX[NUM_NODES - 1] + random(-150, 150), height);
endShape();
}
}
for (int i = 0; i < 20; i++) {
pushMatrix();
translate(random(0, width), random(0, height));
scale(random(0, 1));
beginShape();
fill(0, 0, 0);
noStroke();
vertex(55, 20);
vertex(75, 40);
bezierVertex(75, 37, 70, 25, 50, 25);
bezierVertex(20, 25, 20, 62.5f, 20, 62.5f);
bezierVertex(20, 80, 40, 102, 75, 120);
bezierVertex(110, 102, 130, 80, 130, 62.5f);
bezierVertex(130, 62.5f, 130, 25, 100, 25);
bezierVertex(85, 25, 75, 37, 75, 40);
endShape();
popMatrix();
}
//endRecord();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment