This is an homage to the indicator of progress in our class, the beloved Green Yes. The randomly generated green yeses below are representative of the chorus of green yeses that resound during class. I thought it was a bit of a fun and personalized twist on generative art.
While the rest of my works do not have an intended audience, this one goes out to Dr. Mendes!
/* Luna Jerjees
Green Yes - Inspired by lecture
*/
let randX;
let randY;
let randSize;
//set up canvas and background
function setup() {
createCanvas(600, 600);
background(0);
}
//intialize variables and call functions
function draw() {
randX = random(0, width); //initialize with a random value
//between 0 and canvas size to generate in
//a random position
randY = random(0,width);
randSize = random(10,100); //random size for each circle
greenYes();
textYes();
mainText();
}
//Main text function
//sets rectangular background and green text
//centered to the middle of the canvas
function mainText(){
properties('black', 'black', 0);
//set fill and stroke color, and stroke size for rect
rectMode(CENTER); //center the rectangle
rect(300, 282, 550, 75);
properties('green', 'green',0);
//set fill and stroke color, and stroke size for text
textSize(50);
//set text size and align
textAlign(CENTER);
text('Can I get a Green Yes?', 300,300);
//output text
}
//initialize circlular green yes buttons
function greenYes(){
properties('green', 'green', 0);
circle(randX, randY, randSize);
}
//initializes the text 'yes' attached to each green yes circle
function textYes(){
properties('white','white', 1);
textSize(20);
textAlign(CENTER);
text('Yes', randX, randY);
}
/* Sets properties in color and stroke size when called
* param fillCol: the color of the fill of the shape
* param strokeCol: the color of the stroke
* param strokeWgt: the size of the individual stroke
*/
function properties(fillCol, strokeCol, strokeWgt){
// if no fill required, leave empty
if (fillCol === ''){
noFill();
}
if (fillCol) { //otherwise, set the specified color
fill(fillCol);
}
if (strokeCol === ''){ //if the stroke color is left empty, set to white
stroke(255);
}
if (strokeCol) { //otherwise, set given color
stroke(strokeCol);
}
strokeWeight(strokeWgt);
}