Skip to content

Instantly share code, notes, and snippets.

@MichaelPaulukonis
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MichaelPaulukonis/8928579 to your computer and use it in GitHub Desktop.
Save MichaelPaulukonis/8928579 to your computer and use it in GitHub Desktop.
Processing MOOC week 2
// https://class.coursera.org/compartsprocessing-001/human_grading/view/courses/972068/assessments/3/submissions
//
// In this assignment, you must produce an original sketch containing at least 20 distinct objects of at least 2 kinds of shapes.
// Each object must be unique, in shape (ellipse, rect, etc), or in color, or in size.
// Although shapes must be visible on your canvas, you may include objects which are partially out of view.
// Additionally, you must include a 2 sentence (minimum) description of your artistic intent/goal for your assignment.
// This sketch contains two areas painted with rectangles of technically
// identical colors and transparency, but diminishing size, such that
// subsequent applications build from a dark tint of the background, to a
// stronger intensity of the rectangles' own hue. There is a slight
// "jitter" to keep the transitions from being purely mechanical, but is
// pretty much only obvious with a brighter background and greater offset
// between subsequent rectangles. The layout and colors were inspired by
// Mark Rothko, in particular "No. 14":
// http://en.wikipedia.org/wiki/File:Rothko_No_14.jpg Other color
// combinations were tried out, but this was pretty much the only layout
// attempted. Potential variations include different layouts, more
// modular code (the current "drawUpper()" and "drawLower()" routines beg
// for refactoring), and random selection from predefined palettes.
int width = 600;
int height = 600;
void setup() {
size(width, height);
// background(#717169); // greyish
// background(#E8EAF5); // very pale bluish white
background(#000000); // black [ugh. "pure" black]
// background(#39010E); // blue
// background(#F1FA00); // yellow
noStroke();
}
void drawUpper(color blockColor) {
int offset = 5;
int curoffset = offset;
float jitter;
int above = (height / 3 * 2) -10;
int blockwidth = width;
int blockheight = height;
fill(blockColor, 15);
while (blockwidth > 0 && blockheight > 0) {
blockwidth = width - (2 * curoffset);
blockheight = above - (2 * curoffset);
// println("curoffset: " + curoffset + " width: " + blockwidth + " height: " + blockheight );
jitter = random(-offset, offset);
println("jitter: " + jitter);
rect(curoffset + jitter, curoffset + jitter,
blockwidth - ( 2 * jitter), blockheight - (2 * jitter));
curoffset = curoffset + offset;
}
}
// differs in terms of color
void drawLower(color blockColor) {
int offset = 2;
int curoffset = offset;
float jitter;
int above = (height / 3 * 1);
int blockwidth = width;
int blockheight = height;
fill(blockColor, 1);
while (blockwidth > 0 && blockheight > 0) {
jitter = random(-offset, offset);
blockwidth = width - (2 * curoffset);
blockheight = above - (2 * curoffset);
// println("curoffset: " + curoffset + " width: " + blockwidth + " height: " + blockheight );
// TODO: these calcs are too crude
rect(curoffset + jitter, (above * 2) + curoffset + jitter,
blockwidth - (2 * jitter), blockheight - (2 * jitter));
curoffset = curoffset + offset;
}
}
void draw() {
// drawUpper(#FFEA29);
drawUpper(#0E0139);
// drawLower(#F2975A);
drawLower(#FA0000);
// save("rk0.jpg");
noLoop();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment