LO2: Generative Art

Work Title: Quantum Fluctuations

Artist: Markos R. Kay

https://www.mrkism.com/

This work is made from multi-layered virtual experiments that demonstrate the fundamental and transient nature of the quantum world that we all live in. What fascinates me the most is the work’s visual impact. Although the quantum world is a difficult object to measure, this drawing allows me to see things that are not visible to the naked eye, which also resonates with the value of art: allows one to visualize imaginative ideas. In this art piece, parallel to those experiments conducted in the laboratory, the particles are simulated as brush strokes in order to paint the image of a proton collision. The algorithms behind this artwork consist of rigorous data collection of the proton beams, particle analysis, time, etc. According to the artist’s website, the visualizations of these processes are created with “input from scientists working on Large Hadron Collider at the CERN, Geneva. Beyond algorithms, the artist uses color combinations to create depth that draws our attention to its innermost point. The colors are stacked together with different alpha values to create blurriness and reflections. The realistic effects of the shapes and their splashing particles bring the artwork to life as if it was a standing painting.

Project-02: Variable Faces

My variable faces are all completely computer generated and unique. Every feature is drawn from a set of randomly generated variables. I like the variation in emotions they can express.

sketch
// Evan Stuhlfire
// estuhlfi, Section B
// Project-02: Variable Faces; Face Variables

// Declare global variables


// variable controling head dimensions and shape
var headX = 0; // x value of head center
var headY = 0; // y value of head center
var minHead = 100;
var maxHeadW = 500; //max head width
var maxHeadH = 420; // max head height
var headHeight = 300;
var headWidth = 350;

// variables controling face dimensions and attributes
var eyeSize = 25;
var percentEyeW = 1; // value to adjust eye shape and position
var percentEyeH = 1; // value to adjust eye shape and position
var eyeVert = 2;
var lookAdjustLeft = .25; // Controls eye placement for look direction
var lookAdjustRight = .25;
var lookMax = .45;

// variable to control nose
var nose1 = 1;
var nose2 = 1.1;
var nose3 = 1.1;
var nose4 = 1;
var noseEnd = 1;
var noseLeft1 = 1;
var noseLeft2 = .9;
var noseLeft2 = 1;

// mouth variables
var noseMouthGap = 10;
var mouthStart = 1;
var mouth1 = 1.05;
var mouth2 = 1;
var mouthIncrease = 1.02;

//  color variables
var color1 = 0;
var color2 = 0;
var color3 = 0;

function setup() {
    createCanvas(640, 480);

    // set head center
    centerX = width/2;
    centerY = height/2;

    // get initial colors
    getRandomColors();
}

function draw() {
    var colorChange = .4; // factor to modify color

    background(color1, color2, color3); // draw background from color variables

    // calculate eyes
    var eyeLeftX = centerX - headWidth * lookAdjustLeft; // x coordingate of left eye
    // x coordinate of right eye, can look different directions
    var eyeRightX = centerX + headWidth * lookAdjustRight; 
    var eyeHeight = min(eyeSize * percentEyeH, headHeight * .90);
    var eyeWidth = eyeSize * percentEyeW;
    var eyePositionY = height / eyeVert; // calculate vertical position of eyes 

    
    // calculate pupils
    var pupilSize = .2;
    var pupilLook = 4;
    var pupilX = eyeLeftX;
    var pupilY = eyeRightX;

    if (lookAdjustLeft > lookAdjustRight){ // looking left move pupils left
        pupilX -= pupilLook;
        pupilY -= pupilLook;
    } else { // looking right move pupils right
        pupilX += pupilLook;
        pupilY += pupilLook;
    }

    // variables for nose
    var maxNose = .90;

    var nose1X = (eyeLeftX + eyeRightX)/2;
    var nose1Y = eyePositionY; 
    if (lookAdjustLeft > lookAdjustRight) { 
        // looking left point nose left
        var nose2X = nose1X * noseLeft1;
        var nose2Y= min(nose1Y * nose2, (centerY + headHeight/2) * maxNose);
        var nose3X = nose2X * noseLeft2;
        var nose3Y= min(nose2Y * nose3, (centerY + headHeight/2) * maxNose);
        var nose4X= nose1X * noseLeft3;
        var nose4Y= min(nose3Y * nose4, (centerY + headHeight/2) * maxNose + noseMouthGap);
    } else { 
        // looking right point nose right 
        var nose2X = nose1X * nose1;
        var nose2Y= min(nose1Y * nose2, (centerY + headHeight/2) * maxNose);
        var nose3X = nose2X * nose3;
        var nose3Y= min(nose2Y * nose3, (centerY + headHeight/2) * maxNose);
        var nose4X= nose1X * noseEnd;
        var nose4Y= min(nose3Y * nose4, (centerY + headHeight/2) * maxNose + noseMouthGap);   
    }

    // calculate mouth
    var maxMouth = .98;
    var mouth1X = centerX * mouthStart;
    var mouth1Y = min(nose4Y * mouth1, (centerY + headHeight/2) - noseMouthGap);
    // keep mouth on face
    if (headHeight > headWidth){
        mouth1X = centerX - noseMouthGap;
    }
    var mouth2X = mouth1X * mouthIncrease;
    var mouth2Y = mouth1Y * mouth2;
    var mouth3X = mouth2X * mouthIncrease;
    var mouth3Y = mouth2Y;
    var mouth4X = mouth3X * mouthIncrease;
    var mouth4Y = mouth1Y;



    // draw head
    fill(color1 * colorChange, color2, color3);
    ellipse(centerX, centerY, headWidth,  headHeight);

    // draw eyes
    fill(color1, color2 * colorChange, color3);
    ellipse(eyeLeftX, eyePositionY, eyeWidth, eyeHeight);
    ellipse(eyeRightX, eyePositionY, eyeWidth, eyeHeight);

    // draw pupils
    fill(10);
    ellipse(pupilX, eyePositionY, eyeWidth * pupilSize, eyeHeight * pupilSize);
    ellipse(pupilY, eyePositionY, eyeWidth * pupilSize, eyeHeight * pupilSize);

    // draw mouth
    beginShape();
    curveVertex(mouth1X, mouth1Y);
    curveVertex(mouth1X, mouth1Y);
    curveVertex(mouth2X, mouth2Y);
    curveVertex(mouth3X, mouth3Y);
    curveVertex(mouth4X, mouth4Y);
    curveVertex(mouth4X, mouth4Y);
    endShape();

    // draw nose 
    fill(color1 * colorChange, color2, color3);
    beginShape();
    curveVertex(nose1X, nose1Y);
    curveVertex(nose1X, nose1Y);
    curveVertex(nose2X, nose2Y);
    curveVertex(nose3X, nose3Y);
    curveVertex(nose4X, nose4Y);
    curveVertex(nose4X, nose4Y);
    endShape();
}

function mousePressed() {
    // When the mouse is clicked random values are generated to control the 
    // dimensions, position, and color of a face

    // randomly generate head value
    headWidth = random(minHead, maxHeadW);
    headHeight = random(minHead, maxHeadH);

    // randomly generate eye values
    eyeSize = headWidth * random(.1, .3);
    percentEyeW = random(.5, 1); 
    percentEyeH = random(.5, 1);
    eyeVert = random(2, 2.25); // vertical position of eyes
    lookAdjustLeft = random(.01, lookMax);
    lookAdjustRight = lookMax - lookAdjustLeft;

    // generate nose values
    nose1 = random(1, 1.1);
    nose2 = random(1, 1.2);
    nose3 = random(1.1, 1.15);
    nose4 = random(.98, 1.05);
    noseEnd = random(.95, 1.05);
    noseLeft1 = random(.95, 1);
    noseLeft2 = random(.85, 1);
    noseLeft3 = random(1, 1.12);

    // generate mouth values
    mouthStart = random(.95, 1.05);
    mouth1 = random(1.05, 1.2);
    mouth2 = random(.98, 1.02);
    mouthIncrease = random(1.02, 1.03);

    // randomly generate a new color combination
    getRandomColors();
}

function getRandomColors(){
    // function generates a random number for color variables
    color1 = random(80, 255); 
    color2 = random(80, 255);
    color3 = random(80, 255);
}


Project-02 Variable Faces

I was going to try with different expressions, but my if-else statement doesn’t seem to work for random(). However, I used mouseY instead for the crying effect.

sketchDownload
/* Jiayi Chen
   jiayiche    Section A */
function setup() {
    createCanvas(480, 640);
}

var width = 480;
var height = 640;
var x=width /100;
var y=height/100;
var faceWidth= 80*x;
var faceHeight= 80*y;
var r = 0;
var g = 0;
var b = 0;
var eyebrowshape=1;
var eyebrowy2= 27*y;
var eyebrowy1= 27*y;
var mouthSizeX = 20*x;
var mouthSizeY = 10*y;


function draw() {
    background(220);
    fill(255,229,204);
    ellipse(50*x, 50*y, faceWidth,  faceHeight); //head

    var leftEyex=50*x-faceWidth/4;                 //eyes
    var rightEyex=50*x+faceWidth/4;
    var leftEyey=50*y-faceHeight/8;
    var rightEyey=50*y-faceHeight/8;
    var eyeSizex=20*x;
    var eyeSizey=20*y;
    fill(255);
    ellipse(leftEyex, leftEyey, eyeSizex,eyeSizey);//Left eyes
    fill(r,g,b);
    ellipse(leftEyex, leftEyey, eyeSizex*2/3,eyeSizey*2/3);
    fill(255);
    ellipse(rightEyex,rightEyey,eyeSizex,eyeSizey);//Right eyes
    fill(r,g,b);
    ellipse(rightEyex,rightEyey,eyeSizex*2/3,eyeSizey*2/3);
    fill(r,g,b);                                     //hairs
    strokeWeight(0)
    rect(20*x,5*y,60*x,10*y);
    rect(20*x,15*y,10*x,7*y);
    rect(70*x,15*y,10*x,7*y);
    rect(30*x,15*y,10*x,5*y);
    rect(60*x,15*y,10*x,5*y);
    rect(40*x,15*y,15*x,2*y);
    rect(50*x,15*y,15*x,2*y);
    strokeWeight(10);                                  //eyebrow
    stroke(0);
    var z=5*x;
    var Leyebrowx1= 50*x-faceWidth/4-z ;
    var Reyebrowx1= 50*x+faceWidth/4-z;
    var Leyebrowx2= 50*x-faceWidth/4+10*x-z;
    var Reyebrowx2= 50*x+faceWidth/4+10*x-z;

    line(Leyebrowx1,eyebrowy1,Leyebrowx2,eyebrowy2); //left eyebrow
    line(Reyebrowx1,eyebrowy2,Reyebrowx2,eyebrowy1); //right eyebrow
    var mouthStroke = 2
    strokeWeight(mouthStroke);                       //mouthes
    fill(255,0,0);
    ellipse(50*x,70*y,mouthSizeX,mouthSizeY);     
    if(mouseY<=100*y/2) {        //tears
      fill(0,0,255)
      strokeWeight(0)
      rect(leftEyex,leftEyey+10*y,5*x,20*y)
      rect(rightEyex,rightEyey+10*y,5*x,20*y)
      rect(leftEyex-5*x,leftEyey+20*y,5*x,20*y)
      rect(rightEyex-5*x,rightEyey+20*y,5*x,20*y)
    }
    fill(204,102,0)
    ellipse(50*x,50*y,10*x,10*y);   

}


function mousePressed() {
    r = random(0,255);
    g = random(0,255);
    b = random(0,255);
    mouthSizeX =random(10*x,30*x);
    mouthSizeY =random(0*y,20*y);
    eyebrowy2= random (20*y,35*y)
    eyebrowy1= random (20*y,35*y)
}

Project-02

I started off using the baseline template for a generative face that was given. I then used multiple if else statements to randomize the use of the nose, round mouth, curved mouth, curved eyes, square eyes, and colors of the inner and outer shapes.

sketch

// Sowang Kundeling Section C Project 02

var r = 141;
var g = 35;
var b = 173;
var r2 = 210;
var g2 = 250;
var b2 = 233;
var eyeColor = 0
var faceWidth = 250;
var faceHeight = 300;
var eyeSize = 25;
var mouthWidth = 15;
var mouthPosition = 240;
 
function setup() {
    createCanvas(640, 480);
}
 
function draw() {
    background(166, 215, 227);
    noStroke();

    fill(r, g, b);
    ellipse(width/2, height/2, faceWidth+130, faceWidth+130); // hair

    if(faceHeight <= 125) {
        fill(r2, g2, b2);
        ellipse(width / 2, height / 2, faceWidth*.5, faceHeight*1.5); // cross ellipses
        ellipse(width / 2, height / 2, faceWidth*1.5, faceHeight*.5);
    }   

    fill(r2, g2, b2);
    ellipse(width / 2, height / 2, faceWidth,  faceHeight); // face shape
    var eyeLX = width / 2 - faceWidth / 4; // eye variables
    var eyeRX = width / 2 + faceWidth / 4;

    
    if(r <= 100) {
        fill(eyeColor);
        ellipse(eyeLX, (height / 2) - 5, eyeSize, eyeSize); // eye
        ellipse(eyeRX, (height / 2) - 5, eyeSize, eyeSize);
        fill(r2, g2, b2);
        ellipse(eyeLX, height / 2, eyeSize, (eyeSize / 2) + 9); // under eye shape to make arc
        ellipse(eyeRX, height / 2, eyeSize, (eyeSize / 2) + 9);
    } else {
        fill(eyeColor);
        rect(eyeLX -8, (height / 2) - 13, eyeSize/2, eyeSize/2); // square eye
        rect(eyeRX -8, (height / 2) - 13, eyeSize/2, eyeSize/2);
    }

    if(eyeColor <= 50) {
        fill(eyeColor);
        ellipse(width / 2, mouthPosition + 30, mouthWidth, mouthWidth); // round mouth
    } else {
        fill(eyeColor)
        ellipse(width / 2, mouthPosition + 30, mouthWidth + 5, mouthWidth); // arc mouth
        fill(r2, g2, b2);
        ellipse(width / 2, mouthPosition + 25, mouthWidth + 8 , mouthWidth +3); // shape to make arc
    }

    if(mouthPosition >= 240) { // nose
        fill(eyeColor);
        triangle(width/2, height/2, width/2 + 8, height/2 + 18, width/2 - 8, height/2 + 18);
    }
}
 
function mousePressed() {
    r = random(0, 199);
    g = random(0, 199);
    b = random(0, 199);
    r2 = random(200, 255);
    g2 = random(200, 255);
    b2 = random(200, 255);
    eyeColor = random(0, 100);
    faceWidth = random(75, 150);
    faceHeight = random(100, 150);
    eyeSize = random(20, 35);
    mouthWidth = random(10, 25);
    mouthPosition = random(220, 250);
}

Project 02 – Variable Faces

My Goal was to create a simple interactive face which resulted different types with each click. Click to see different faces.

sketch
//Favour Adesina Section B

var faceWidth = 300;
var lipHeight = 20;
var lipWidth = 60;
var BlipWidth = 100;
var eyeWidth = 70;
var eyeHeight = 100;
var pupSize = 60;
var faceHeight = 400;


function setup() {
    createCanvas(600, 480);
    background(220);
    text("p5.js vers 0.9.0 test.", 10, 15);
}

function draw() {
    noStroke()
    background(247, 195, 218);

    //SHOULDER
    fill(255, 67, 89);
    ellipse(width/2, height/2 + faceHeight/2, 2*faceWidth, faceHeight);

    //EARS
    fill(141, 75, 36);
    ellipse(width/2 - faceWidth/2, height/2, faceWidth/4, faceHeight/4); //right ear outer
    ellipse(width/2 + faceWidth/2, height/2, faceWidth/4, faceHeight/4);  //left ear outer
    fill(34, 20, 13);
    ellipse(width/2 - faceWidth/2, height/2, faceWidth/8, faceHeight/8);    //right ear inner
    ellipse(width/2 + faceWidth/2, height/2, faceWidth/8, faceHeight/8);    //left ear inner
    //FACE
    fill(141, 75, 36);
    ellipse(width/2, height/2, faceWidth, faceHeight);    // face

    //EARRINGS
    fill(255, 255, 0);
    triangle((width/2 - (faceWidth/2 + faceWidth/50)), height/2 + faceHeight/4, width/2 - faceWidth/2, height/2 + faceHeight/16, width/2 - faceWidth/1.5, height/2 + faceHeight/4);
    triangle((width/2 + (faceWidth/2 - faceWidth/100)), height/2 + faceHeight/4, width/2 + faceWidth/2, height/2 + faceHeight/16, width/2 + faceWidth/1.55, height/2 + faceHeight/4);


    //EYES
    var LXeye = width/2 - faceWidth * 0.26;          
    var RXeye = width/2 + faceWidth * 0.26;
    fill(255, 255, 255);
    ellipse(LXeye, height/2, eyeWidth, eyeHeight);    //Eye Whites 
    ellipse(RXeye, height/2, eyeWidth, eyeHeight);    //Eye Whites
    fill(104, 54, 37);
    ellipse(LXeye, height/2, pupSize, pupSize);    //Pupils 
    ellipse(RXeye, height/2, pupSize, pupSize);     //pupils 
    fill(0);
    ellipse(LXeye, height/2, 20, 20);                //inner pupils 
    ellipse(RXeye, height/2, 20, 20);                //inner pupils
       
    //NOSE
    stroke(35, 31, 32);
    strokeWeight(7);
    line(width/2, height/2, width/2, (height/2)+ eyeHeight/3);                         //Nose bridge
    ellipse((width/2)-5, (height/2)+ eyeHeight/3, faceWidth/25, faceWidth/25);            // nose 
    ellipse((width/2)+5, (height/2)+ eyeHeight/3, faceWidth/25, faceWidth/25);            // nose

    //LIPS
    strokeWeight(2);
    var BlipY = height/2 + faceHeight * 0.27 + lipHeight/2;
    fill(122, 22, 25);
    ellipse(width/2, BlipY, BlipWidth, lipHeight);
    noStroke();
    fill(173, 69, 87);                                   //light pink 
    ellipse(width/2, BlipY, lipWidth/2, lipHeight/2);  //inner mouth

    


    //HAIR
    fill(34, 20, 13);
    ellipse(width/2, height/2 - faceHeight/2, width/7, height/6);
    ellipse(width/2 - 55, height/2 - faceHeight/2, width/8, height/7);
    ellipse(width/2 + 55, height/2 - faceHeight/2, width/8, height/7);
 

        }

function mousePressed() {

    faceWidth = random(300, 500);
    faceHeight = random(260, 400);
    lipHeight = random(10, 50);
    pupSize = random(20, 70);
    lipWidth = random(10, 60);
    BlipWidth = random(30, 100);
    eyeWidth = random(20, 150);
    eyeHeight = random(80, 170);

}

Project 02: Variable Faces

This is my project 02 “Variable Faces”. The most challenging part of this project is organizing the logic of my code. Once the logic is sorted out it was actually not too complicated. I struggled a bit with certain shapes.

sketch
/* Jenny Wang
   Section B */

var eyes = 3;
var features = 3;
var mouth = 3;
var hair = 3;

function setup() {
    createCanvas(480, 640);
}

function draw() {
    background(250,160,150);
    noStroke()
    fill(230,89,132);
    ellipse()
    noStroke();
    fill(226,190,134);
    ellipse(234,258,199,250);//face
    strokeWeight(2); //nose
    stroke(177,123,60);
    line(231,272,220,300);
    strokeWeight(2);
    stroke(177,123,60);
    line(220,300,236,302);


    if(eyes<=1){ //round eyes
        noStroke();
        fill(255,255,255);
        circle(182,252,46);
        noStroke();
        fill(162,196,231);
        circle(182,252,29);
        noStroke();
        fill(43,91,137);
        circle(182,252,17);
        //left eye
        noStroke();
        fill(255,255,255);
        circle(292,252,46);
        noStroke();
        fill(162,196,231);
        circle(292,252,29);
        noStroke();
        fill(43,91,137);
        circle(292,252,17);
        //right eye
    }
    else if(eyes<=2){ //squint eyes
        strokeWeight(3);
        stroke(65,50,20)
        line(170,253,197,265);
        line(170,280,197,265);//left eye
        line(270,265,297,254);
        line(297,280,270,265);//right eye
    }
    else if (eyes<=3){ //half eyes
        noStroke();
        fill(255,255,255);
        arc(182,252,46,46,2.6,0.5,open)
        noStroke();
        fill(164,209,125);
        circle(182,252,29);
        noStroke();
        fill(177,123,57);
        circle(182,252,17);
        //left eye
        noStroke();
        fill(255,255,255);
        arc(292,252,46,46,2.6,0.5,open)
        noStroke();
        fill(164,209,125);
        circle(292,252,29);
        noStroke();
        fill(177,123,57);
        circle(292,252,17);
    }

    if(features<=1){ //mole
        strokeWeight(3);
        fill(177,123,57)
        point(186,321);
    }
    else if(features<=2){ //freckles
        strokeWeight(3);
        fill(177,123,57);
        point(162,301);
        strokeWeight(3);
        fill(177,123,57);
        point(177,309);
        strokeWeight(3);
        fill(177,123,57);
        point(194,303);
        strokeWeight(3);
        fill(177,123,57);
        point(265,306);
        strokeWeight(3);
        fill(177,123,57);
        point(283,299);
        strokeWeight(3);
        fill(177,123,57);
        point(298,308);
    }
    else if(features<=3){ //blush
        noStroke();
        fill(239,171,199);
        ellipse(164,306,28,16);
        noStroke();
        fill(239,171,199);
        ellipse(305,306,28,16);
    }

    if(mouth<=1){ //happy laugh
        noStroke();
        fill(246,166,193);
        arc(237,324,80,70,0,0.6 + 2.6, OPEN);
    }
    else if(mouth<=2){//sad mouth
        strokeWeight(4);
        stroke(246,160,193);
        line(214,350,235,343);
        strokeWeight(4);
        stroke(246,160,193);
        line(256,350,235,343);
    }
    else if(mouth<=3){ //mouth with teeth
        noStroke();
        fill(237,10,124);
        arc(237,324,80,70,0,0.6 + 2.6, OPEN);
        noStroke();
        fill(255,255,255);
        rect(227,323,21,11);
    }

    if(hair<=1){ //red hair
        noStroke();
        fill(199,102,29);
        arc(233,179,160,93,2.6,0.5, OPEN);
        noStroke();
        fill(199,102,29);
        circle(347,197,95);
        noStroke();
        fill(199,102,29);
        circle(116,197,95);
    }
    else if(hair<=2) { //blonde hair
        noStroke();
        fill(231,209,100);
        circle(234,124,98);
        noStroke();
        fill(231,209,100);
        circle(305,148,84);
        noStroke();
        fill(231,209,100);
        circle(342,203,58);
        noStroke();
        fill(231,209,100);
        circle(347,244,45);
        noStroke();
        fill(231,209,100);
        circle(160,148,84);
        noStroke();
        fill(231,209,100);
        circle(127,203,58);
        noStroke();
        fill(231,209,100);
        circle(121,244,45);
    }
    else if(hair<=3){ //brown hair
        noStroke();
        fill(177,123,57);
        arc(233,180,232,126,2.6,0.5, OPEN);
        noStroke();
        fill(177,123,57);
        rect(118,180,38,205)
        noStroke();
        fill(177,123,57);
        rect(311,180,38,205);
    }
    
    noStroke(); //neck
    fill(226,190,134);
    rect(210,378,48,63);
    noStroke(); //body
    fill(226,190,134);
    rect(120,415,231,225,65,65,0,0);
    noStroke(); //dress
    fill(184,191,225);
    quad(155,527,202,415,265,415,320,527);
    noStroke(); 
    fill(226,190,134);
    triangle(202,415,265,415,233,475);
    noStroke(); 
    fill(184,191,225);
    rect(155,527,164,113);
}

function mousePressed() {
    eyes = random (0,3);
    features = random (0,3);
    mouth = random (0,3);
    hair = random (0,3);
}
    

Project 2: Variable Face

sketch
var eyeSize = 20;
var faceWidth = 100;
var faceHeight = 150;
var R = 0;
var G = 0;
var B = 0;
var FR = 252;
var FG = 224;
var FB = 203;
var nose = 10
var HR = 100;
var HG = 100;
var HB = 100;
var CR = 140;
var CG = 140;
var CB = 140;



 
function setup() {
    createCanvas(300, 300);
}
 
function draw() {
    background(R,G,B);
    noStroke();
    //back hair
    fill(HR,HG,HB);
    ellipse(width / 2, height / 2, faceWidth+10,  faceHeight+10);
    strokeWeight(2);
    stroke(0);
    rect(width / 2 - faceWidth/2-5, height / 2 -20, faceWidth + 10, faceHeight/2+25);
    noStroke();
    //clothes
    if(mouseX < width/2){
        fill(CR,CG,CB);
        ellipse(width/2,height,faceWidth+50,height/2 +faceHeight/2-10);
        fill(CR+40,CG+40,CB+40);
        ellipse(width/2,height/2 + faceHeight/2 +faceWidth/4+20, 10);
        ellipse(width/2,height/2 + faceHeight/2 +faceWidth/4+30, 10);
        ellipse(width/2,height/2 + faceHeight/2 +faceWidth/4+10, 10);
    }else{
        fill(255-CR,255-CG,255-CB);
        ellipse(width/2,height,faceWidth+50,height/2 +faceHeight/2-10);
        fill(CR+40,CG+40,CB+40);
        ellipse(width/2,height/2 + faceHeight/2 +faceWidth/4+20, 10);
        ellipse(width/2,height/2 + faceHeight/2 +faceWidth/4+30, 10);
        ellipse(width/2,height/2 + faceHeight/2 +faceWidth/4+10, 10);

    }
    //neck
    fill(FR-20,FG-20,FB-20);
    rect(width/2- faceWidth/8, height/2 + faceHeight/2 -10, faceWidth/4,20);
    ellipse(width/2, height/2 + faceHeight/2 +10, faceWidth/4,faceWidth/4);
    //face outline
    fill(FR,FG,FB);
    ellipse(width / 2, height / 2, faceWidth,  faceHeight);
    var eyeLX = width / 2 - faceWidth * 0.25;
    var eyeRX = width / 2 + faceWidth * 0.25;
    //eye
    fill(255);
    strokeWeight(1);
    stroke(0);
    ellipse(eyeLX, height / 2, eyeSize, eyeSize);
    ellipse(eyeRX, height / 2, eyeSize, eyeSize);
    noStroke();
    fill(0);
    ellipse(eyeLX,height / 2,eyeSize / 2);
    ellipse(eyeRX, height / 2, eyeSize / 2);
    fill(255);
    ellipse(eyeLX + 2,height / 2 -2,eyeSize / 6);
    ellipse(eyeRX + 2,height / 2 -2,eyeSize / 6);

    //mouth
    fill(240,90,85);
    arc(150,180,20,20,0,PI, open);
    //teeth
    fill(255);
    rect(145,180,10,2);
    //nose
    strokeWeight(2);
    stroke(0);
    line(150,150,150,150 + nose);
    //front hair
    fill(HR,HG,HB);
    arc(width / 2, height / 2-15, faceWidth+10,  faceHeight-10, PI,2*PI, PI);
}
 
function mousePressed() {
    // when the user clicks, these variables are reassigned
    // to random values within specified ranges. For example,
    // 'faceWidth' gets a random value between 75 and 150.
    R = random(50,250);
    G = random(0,256);
    B = random(0,256);
    FR = R + 50;
    FG = FR - 25;
    FB = FG - 25;
    HR = 255-R;
    HG = 255-G;
    HB = 255-B
    faceWidth = random(75, 150);
    faceHeight = random(100, 150);
    eyeSize = random(20, 30);
    nose = random(10,20);
    CR = random(100,200);
    CG =random(100,200);
    CB =random(100,200);
}

Project-02

Here is my changing face! I think I struggled the most with deciding what nostril shape I wanted, as well as whether I wanted the eyebrows to be downturned (making them angry) or flat. I decided on flat, so that the face could smile.

sketch

// Amanda Wen Section C

var eyeSizeW = 50
var eyeSizeH = 70
var pupilSizeW = 20
var pupilSizeH = 30
var faceWidth = 180
var faceHeight = 150
var noseWidth = 5
var noseHeight = 3
var eyebrowWidth = 30
var eyebrowHeight = 10

var skinR = 60
var skinG = 137
var skinB = 97

var eyeR = 144
var eyeG = 185
var eyeB = 147

var pupilR = 34
var pupilG = 83
var pupilB = 75

var eyebrowR = 22
var eyebrowG = 59
var eyebrowB = 34

var noseR = 22
var noseG = 59
var noseB = 34

var mouthR = 186
var mouthG = 202
var mouthB = 181


function setup() {
    createCanvas(640, 480);
    background(255);
    text("p5.js vers 0.9.0 test.", 10, 15);
}

function draw() {
    background(58, 81, 78); // background color
    noStroke();
// face
    fill(skinR, skinG, skinB); // face color
    ellipse(width / 2, height / 2, faceWidth, faceHeight); // face shape

// eyeballs
    var eyeLX = width / 2 - faceWidth * 0.25;
    var eyeRX = width / 2 + faceWidth * 0.25;
    fill(eyeR, eyeG, eyeB); // eye color
    ellipse(eyeLX, height / 2, eyeSizeW, eyeSizeH); // left eyeball
    ellipse(eyeRX, height / 2, eyeSizeW, eyeSizeH); // right eyeball

// pupils
    var pupilLX = width / 2 - faceWidth * 0.25;
    var pupilRX = width / 2 + faceWidth * 0.25;
    fill(pupilR, pupilG, pupilB); // pupil color
    ellipse(pupilLX, height / 2, pupilSizeW, pupilSizeH); // left pupil
    ellipse(pupilRX, height / 2, pupilSizeW, pupilSizeH); // right pupil

// eyebrows
    var eyebrowLX = width / 2 - faceWidth * 0.35;
    var eyebrowRX = width / 2 + faceWidth * 0.2;
    fill(eyebrowR, eyebrowG, eyebrowB); // eyebrow color
    rect(eyebrowLX, height / 2.5, eyebrowWidth, eyebrowHeight); // left eyebrow
    rect(eyebrowRX, height / 2.5, eyebrowWidth, eyebrowHeight); // right eyebrow

// nostrils
    var noseLX = width / 2 - faceWidth * 0.05;
    var noseRX = width / 2 + faceWidth* 0.03;
    fill(noseR, noseG, noseB); // nose color
    rect(noseLX, height / 1.8, noseWidth, noseHeight) // left nostril
    rect(noseRX, height / 1.8, noseWidth, noseHeight) // left nostril

// mouth
    var mouth = width / 2 + faceWidth * 0.01;
    fill(mouthR, mouthG, mouthB); // mouth color
    arc(mouth, height * 0.6, 40, 20, radians(0), radians(180)); // mouth shape
}

function mousePressed() {
    // face shape random
    faceWidth = random(180, 150)
    faceHeight = random(180, 150)
    // eye shape random
    eyeSizeW = random(50, 70);
    eyeSizeH = random(50, 70);
    // pupil shaperandom
    pupilSizeH = random(20, 30);
    pupilSizeW = random(20, 30);

    // skin color random
    skinR = random(180, 200);
    skinG = random(180, 200);
    skinB = random(180, 200);
    // eye color random
    eyeR = random(100, 160);
    eyeG = random(100, 160);
    eyeB = random(100, 160);
    // pupil color random
    pupilR = random(108, 90);
    pupilG = random(108, 90);
    pupilB = random(108, 90);
    // eyebrow color random
    eyebrowR = random(110, 103);
    eyebrowG = random(110, 103);
    eyebrowB = random(110, 103);
    // nose color random
    noseR = random(130, 200);
    noseG = random(130, 200);
    noseB = random(130, 200);
    // mouth color
    mouthR = random(120, 100);
    mouthG = random(120, 100);
    mouthB = random(120, 100);
}
 

LO 2: Generative Art

I found that the work Into the Trees by Robert Hodgin is very interesting and inspiring. This work depicts a walk into the forest with colorful small path that change colors and glowing light all the time. The feeling it brings to me as the scene goes into the forest is very refreshing. The change of day and night also makes the project more interesting, making me feel like I’m exploring the forest for a very long time.

I think the changing colors of the path is really the greatest part of the project. This rainbow glowing path catches my eyes from the start, and as it extends into the forest, I can’t help myself imagining this as a game scene and I’m following this path to a place where there’s a very beautiful creature.

From the technics used, I think the artist generates a 3-D world that’s generating new scenes. With a background showing changing day and night, the artist then randomly generates the path and trees alongside.

Looking Alp-wards

Leander Herzog’s “Alp” (2021) is a browser-based program that presents an “alpine” landscape of (presumably) randomly generated shapes. It layers 6-7 coordinated colors in a random yet recognizable landscape form, which is simple yet beautiful to me. The colors are especially eye-catching, and I wonder if they are determined by the same code used by color swatch-generating sites like Coolors and Adobe Color.

my favorite variation of Herzog’s “Alp”

Both the colors and the shapes of the “rocks” seem to be generated concurrently and randomly. Perhaps the shapes are polygons with constrained coordinates that change whenever the function repeats itself. The ellipse in the top left “sky” area doesn’t change in placement or diameter, but its color changes to fit the palette.

Herzog’s other work generally seems to share the “less is more” ideology. Many of his other algorithms use only 2 colors and simple geometry that reacts to mouse clicks and movement. The graphics are so mesmerizing, I could play around with them for hours, and I think you all should too!