Skip to content

Instantly share code, notes, and snippets.

@0q98ahdsg3987y1h987y
Created September 27, 2016 22:26
Show Gist options
  • Save 0q98ahdsg3987y1h987y/75905d98bc59f5b30be551dd17b5701a to your computer and use it in GitHub Desktop.
Save 0q98ahdsg3987y1h987y/75905d98bc59f5b30be551dd17b5701a to your computer and use it in GitHub Desktop.
// constants
final int element1Width = 200;
final int element1Height = 400;
final int element2Width = 115;
final int element2Height = 400;
final int basicStrokeColor = #FFD67C;
void setup () {
// Size and color
size(594, 840, P3D);
background(#C97C00);
// Some basic settings
smooth();
scale(0.5);
sphereDetail(300);
noLoop();
// Create a light source
directionalLight(150, 40, 80, width/2, height/2, -20);
}
void draw () {
for (int patY = 0; patY <= 1 / 0.3 * height; patY += 400) {
int indent = 0;
// Indent the rows every other row
if (patY % 800 == 0) {
indent = 105;
}
for (int patX = 0; patX <= 1/0.3 * width; patX += 210) {
int sumX = patX + indent;
// Element 1
stroke(basicStrokeColor);
strokeWeight(14);
fill(basicStrokeColor);
ellipse(sumX, patY, element1Width, element1Height);
// Element 2
fill(#120C6F);
ellipse(sumX, patY, element2Width, element2Height);
stroke(#FDFFB2);
// 3d shapes
fill(#A6C1A9);
ellipse(sumX, patY, 0.95 * element1Width, 150);
fill(0);
stroke(235, 30);
strokeWeight(15);
pushMatrix();
translate(sumX, patY, noise(sumX, patY, random(100)));
sphere(40);
popMatrix();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment