Project 03: Dynamic Drawing

This animation depicts a sun and a moon rotating in a circle, depending on the location of the user’s mouse. The background the sun passes through changes through sunrise, blue sky, and sunset colors as the sun moves from left to right.

Dynamic DrawingDownload

//Alana Wu
//ID: alanawu
//Section C
//Project-03

//sun and moon move in a circle centered in the canvas
// stars rotate around the moon
//clouds rotate around the sun
//when sun is above height/2, sunrise, then blue, then sunset colors
//when moon is above height/2, varying shades of blue 

function setup()
{
    createCanvas(600, 450);
    background(220);
    text("p5.js vers 0.9.0 test.", 10, 15);
}
var x = 30;

function draw()
{
    strokeWeight(0);
    background(0);

//moves (0,0) to center of canvas
    translate (300, 225);

//as mouse moves from left to right, background sky transitions
//from red (sunrise) to yellow, blue, yellow, and back to red(sunset)
    if (mouseX < 120)
    {
        fill (255, mouseX*2, 0);
    }
    if (mouseX>= 120 & mouseX < 220)
    {
        fill (255, 255, mouseX-40);
    }
//get from (255, 255, 180) to (50, 155, 255)
    if (mouseX>= 220 & mouseX < 300)
    {
        fill (50+(300-mouseX)*2.5, 155+(300-mouseX)*1.2, 255 - (300-mouseX));
    }
//get from (50, 155, 255) to (255, 255, 180)
    if (mouseX >= 300 & mouseX < 380)
    {
        fill (50+(mouseX-300)*2.5, 155+(mouseX-300)*1.2, 255-(mouseX-300));
    }
//from (255, 255, 180) to (255, 240, 0)
    if (mouseX >= 380 & mouseX < 480)
    {
        fill (255, 175+(480-mouseX), (480-mouseX)*1.4);
    }
    if (mouseX >= 480)
    {
        fill(255, 700-mouseX*1.1, 0)
    }
    rect (-300, -225, 600, 225);
    fill (mouseX/25, mouseX/25, 100);
    rect (-300, 0, 600, 225);

//draws background clouds that move horizontally
    push(0);
    fill(235);
 
 //if mouse is pressed, clouds change to dark gray and move left
    if (mouseIsPressed)
    {
        fill (90);
        x -= 5;
    }
    translate (-300, -225);
    ellipse (x, 45, 40, 40);
    ellipse (x+25, 30, 50, 50);
    ellipse(x+35, 60, 35, 35);
    ellipse (x+20, 50, 40, 40);

    ellipse (x+500, 150, 40, 40);
    ellipse (x+475, 160, 50, 50);
    ellipse(x+525, 170, 35, 35);
    ellipse (x+500, 180, 40, 40);

    ellipse (x + 300, 60, 40, 40);
    ellipse (x + 270, 70, 30, 30);
    ellipse (x + 285, 90, 50, 50);
    ellipse (x + 320, 90, 40, 40);

    ellipse (x+50, 100, 40, 40);
    ellipse (x+80, 130, 50, 50);
    ellipse(x+30, 132, 35, 35);
    ellipse (x+58, 135, 50, 50);
    pop();


//draws sun
    push();
    rotate (radians (135+mouseX/3.55));
    fill (255, 255, 0);
    ellipse (90, 90, 50, 50);
            translate (90, 90);
//draws 9 clouds around the sun
    for (var i = 0; i <= 8; i++)
    {
        rotate (radians (40));
        fill (255);
        strokeWeight(0);
        ellipse (mouseX/5 + 5, mouseY/5 + 5, 15, 15);
        ellipse (mouseX/5 - 8, mouseY/5-10, 15, 15);
        ellipse (mouseX/5, mouseY/5, 20, 20);
    }
    pop();

//draws moon
    push();
    
    rotate (radians(315+mouseX/3.55));
    fill (255, 255, 200);
    ellipse (90, 90, 50, 50);
    translate (90, 90);

//draws randomly moving stars around the moon 
    for (var j = 0; j < 5; j++)
        {
            rotate (radians(random (50, 80)));
            fill (255, 255, 204);
            rectMode (CENTER);
            rect (mouseX/9, mouseX/8, 5, 20);
            rect (mouseX/9, mouseX/8, 20, 5);
            push();
            translate (mouseX/9, mouseX/8);

//can you change the frameRate for only a section of the code?
            for (var h = 0; h <= 7; h++)
            {
                fill (255 - mouseX/7, 255 - mouseY/3, 255 - mouseX/5);
                rotate (radians (mouseY));
                ellipse (10+mouseX/20, mouseY/50, 8, 8);
            }
            pop();
        }

 //clouds move horizontally right by .5 every frame
    x += .5;

    pop();

}

Looking Outwards 03: Computational Fabrication

close up of wearable

Wanderers computationally grows wearables through a process that emulates natural growth behavior. The shapes start out as a “seed” and adapt to their environment as they grow. 

The process imitated biological growth by transforming a geometric input into an intermediate representation, then deforming the initial geometric representation. The deformed initial representation reacts to the deformation of the object. This process is done iteratively, so as it repeats, the deformations aggregate into visible growth of the object.

Green and yellow wearable on model

I admire this project because it take biomimicry to the next level; rather than emulating specific end product qualities found in nature, this project literally grows and adapts the same ways living organisms do. Most man-made creations lack this quality. This opens up a whole host of new possibilities in design because as humans, many aspects of the future will always be uncertain, so fixed design will always have a flaw. But if you create algorithms that are capable of adapting to future changes, then design will be much for capable and efficient. Many of the things we design (buildings, energy systems, etc) are meant to exist for long periods of time and will need to be able to adapt to uncertain changes (eg effects of climate change). 

red and orange wearable on model

Looking Outwards 3: Computational Fabrication

One computational fabrication project that I found particularly intriguing is the “Vespers” collection by Neri Oxman’s Mediated Matter Group at MIT. The collection contains three series, each with five 3D-printed and multi-material masks: the Past, Present, and Future.

I find the Future series to be most interesting as it explores death and rebirth by combining living and non-living materials in the masks. This was accomplished by integrating computational design with 3D printing and synthetic biology to direct the growth and expression of the microorganisms inside the mask. The algorithm and tools are customized so that the microorganisms reproduce the colors of the Past series and feature patterns based on the spatial logic in the Present series, maintaining cohesiveness throughout the entire collection and expressing the idea of “rebirth”. I’m impressed by “Vespers” because it’s not only incredibly innovative, but it’s also functional and relevant. The algorithms behind this can be used for so many other applications. For instance, it could be used to create smart packaging that reacts to its environment. This mask collection goes beyond traditional mediums of art; it thoroughly explores the intersection of computation, design, and biology.

A display of how the collection transforms between the three series
(Credit: Yoram Reshef)
A close-up view of Mask 1 in the Present Series
(Credit: Yoram Reshef)

LO: Computational Fabrication

Silk Pavilion

By Mediated Matter Group at MIT Media Lab

I learned about Mediated Matter through a Netflix documentary series called Abstract. Since then, their work at the MIT Media Lab has become my inspiration. I admire this Silk Pavilion project because of the creator’s interplay between design, biology, and computer technology. The creators were inspired by the silk worms’ inherent ability to generate synthetic structures, which they hope to utilize as a building block to bridge the natural world and the built world. The team began by studying the spinning pattern of silkworms and then used it to design larger structures with the support of CNC and CAD. Later, they deployed and guided the silkworms to complete the structure that they designed. The algorithm that generated the work studied individual silkworms and represented their biological pattern through computation. We always talk about biomimicry in design classes, but I never thought about how one can introduce the living subject of mimicry into the manufacturing process, which I find fascinating. Finally, the creators achieved their artistic vision by combining new research methods, cutting-edge technology, and biological knowledge to imagine a future where things, people, and the environment can live in harmony.

The image depicts how the silk structure is fabricated.

Sources:

Website

Video

Looking Outwards 03: Computational Fabrication

Looking through the information about digital fabrication was very interesting to visually see and comprehend. A lot of the pieces reminded me of the third lab assignment we had this week. The random circles and colors compiled together looked similar to the modules in all the photos. Since there are multiple pieces and artists, I chose one project in specific: “Wood Skin Material”. The use of modules and scoring allows wood to become like a “skin-like” material which moves as a malleable blanket would. The “Wood Skin” adapts to each shape while also being able to generate new ones with its flexibility: giving designers freedom of expression with material. I am curious as to what physical designs this can be used for, for my freshman year in design there was a project where the class had to create environmental spaces with the use of simple shaped modules. The result of the project was alike to that of the “Wood Skin”. With just one repeated shape can create more interesting structures by bending, adding, etc.

https://www.behance.net/gallery/14217091/Wood-Skin-Material

Project 2: Variable Face

Karan – Variable Face

var faceWidth = 100
var faceLength = 100
//hat, bow and sun glass colours colours R, G, B
var hbtR = 200
var hbtG = 150
var hbtB = 155

//skin colour variables 
skinColour = 1

//sunglass shape and width
var sgWidth = 20
var sgHeight = 20

// hat size variables
var hatWidth = 200
var hatHeight = 100
var topWidth = 150

// mouth variables
mouth = 1



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

function draw() {
    background(220)
    //skin colour
    if (skinColour==1){
        fill(117,64,27)
    } else if (skinColour==2){
        fill(207,152,84)
    } else if (skinColour==3){
        fill(244,203,151)
    }

     //face
    noStroke()
    ellipse(width/2,height/2, faceWidth, faceLength);

    //sunglasses
    fill(hbtR, hbtG, hbtB);
    ellipse(width/2-1/5*faceWidth, height/2-1/8*faceLength,sgWidth,sgHeight);
    ellipse(width/2+1/5*faceWidth, height/2-1/8*faceLength,sgWidth,sgHeight);
    stroke(hbtR, hbtG, hbtB)
    line(width/2-1/5*faceWidth,height/2-1/8*faceLength,width/2+1/5*faceWidth,height/2-1/8*faceLength);

    //bow
    triangle(width/2,height/2+1/2*faceLength,width/2-15,(height/2+1/2*faceLength)-5,width/2-15,(height/2+1/2*faceLength)+5);
    triangle(width/2,height/2+1/2*faceLength,width/2+15,(height/2+1/2*faceLength)-5,width/2+15,(height/2+1/2*faceLength)+5);

    //nose
    fill(0);
    
    triangle(width/2,height/2,width/2+5,height/2+10,width/2-5,height/2+10);

    //hat
    fill(hbtR,hbtG,hbtB);
    line(width/2-60,height/2-1/3*faceLength,width/2+60,height/2-1/3*faceLength);
    quad(width/2-30,height/2-1/3*faceLength,width/2+30,height/2-1/3*faceLength,width/2+23,height/2-faceLength,width/2-23,height/2-faceLength)
}

function mousePressed() {
    skinColour = int(random(1,4));
    faceWidth = random (75,150);
    faceLength = random(75,150);
    hbtR = random(0,255);
    hbtG = random(0,255);
    hbtB = random(0,255);
}

This is what I imagine my fashion sense in terms of colour coding would be: Same coloured hat, sunglasses and bow-tie. It was interesting to understand the relationship in between variables.

Looking Outwards 2: Generative Art

Coral Moss by Marcin Ignac

The work that I really liked was by Marcin Ignac. His work. ‘Coral Moss’ was the one that caught my eye. I really enjoy the idea of the Generative Growth that he embeds in this experiment. I feel that the colour scheme is really organics and gives the art very impressive flowing nature. Even though there is no set form or structure to the art, the simulation still seems very cohesive and I really appreciate that. The artist has used technologies like glsl, webgl, javascript, pex and nodes to create this real time simulation. As seen on their page, the artist explains that he merges, “reaction diffusion used to The artist strongly believes that data is not just numbers and is in fact a tool for art. He believes that data can be turned into Technology mediated creativity. This can be seen in his work as he uses algorithms to create something really beautiful.

http://marcinignac.com/experiments/codevember18-02-coral-moss/

Project 2: Generating Faces by Mouse Clicking

My attempt at making an interactive variable face generator:

gnmarino-project 2

//variables to use to randomize
var head = 0
var hair = 0
var ear = 0
var nose = 0
var mouth = 0
//hair color
var color1 = 0
var color2 = 0
var color3 = 0
//variables to use to structure everything
var faceDetail = 2
var faceWidth = 300
var faceHeight = 450
//made my own grid system
var cellHeight = 80
var cellWidth = 80

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

 function draw() {
    background(255);
    noStroke();
    //base skin color
    fill(249, 224, 195);
//(the ears)there are four different ear types. 
//each are associated a specific number that is randomly choosen in mouse pressed functionj
//used if statement so that when mouse is pressed it only picks one option (because only one option is true)
    if (ear == 1) {
        ellipse( 1.5 * cellWidth, 3.5 * cellHeight, 2 * cellWidth, cellHeight);
        ellipse( 4.5 * cellWidth, 3.5 * cellHeight, 2 * cellWidth, cellHeight);
    } else if (ear == 2) {
        ellipse( 1.25 * cellWidth, 3.5 * cellHeight, cellWidth, 2 * cellHeight);
        ellipse( 4.75 * cellWidth, 3.5 * cellHeight, cellWidth, 2 * cellHeight);
    } else if (ear == 3) {
        ellipse( 1.5 * cellWidth, 3.5 * cellHeight, 2 * cellWidth, 1.5 * cellHeight);
        ellipse( 4.5 * cellWidth, 3.5 * cellHeight, 2 * cellWidth, 1.5 *cellHeight);
    } else {
        ellipse( 1.5 * cellWidth, 3.5 * cellHeight, 1.25 * cellWidth, cellHeight);
        ellipse( 4.5 * cellWidth, 3.5 * cellHeight, 1.25 * cellWidth, cellHeight);
    } 
    
// (the hair) works the same as ears. has 4 different types of hair
    if (hair == 1) { //mohawk
        //fill color is completely randomized with variables in mouse pressed so that R, B, G is a completely random number everytime
        //so it can make any color in the RBG system to colorize hair
        fill(color1, color2, color3);
        rect(2.5 * cellWidth, .6 * cellHeight, cellWidth, cellHeight);
    } else if (hair == 2) { //afro
        fill(color1, color2, color3);
        ellipse(3 * cellWidth, 2 * cellHeight, 4.5 * cellWidth, 2.75 * cellHeight);
    } else if (hair == 3) { //long hair
        fill(color1, color2, color3);
        ellipse(3 * cellWidth, 2 * cellHeight, 4.75 * cellWidth, 2.5 * cellHeight);
        rect(.625 * cellWidth, 2 * cellHeight, 4.75 * cellWidth, 4.25 * cellHeight);
    } else { //bald
        //to show baldness I put a point that is hidden behind head
        point(width/2, height/2);
    }

    fill(249, 224, 195); //skin color
//heads
//same if statment system as before, 3 head types
    if (head == 1) {
        quad(cellWidth, 1.5 * cellHeight, 5 * cellWidth, 1.5 * cellHeight, 4.5 * cellWidth, 6.5 * cellHeight, 1.5 * cellWidth, 6.5 * cellHeight);
    } else if (head == 2) {
        ellipse(width/2, height/2, faceWidth, faceHeight);
    } else {
    quad( 1.25 * cellWidth, 3 * cellHeight, 4.75 * cellWidth, 3 * cellHeight, 4 * cellWidth, 6.5 * cellHeight, 2 * cellWidth,6.5 * cellHeight);
    circle(width/2, 3 * cellHeight, faceWidth);
    }
// eyes, 1 type
    fill(50);
    ellipse(2.5 * cellWidth, 3 * cellHeight, .25 * cellWidth, .5 * cellHeight);
    ellipse(3.5 * cellWidth, 3 * cellHeight, .25 * cellWidth, .5 * cellHeight);

    noFill();
    strokeWeight(2);
    stroke(50)
//nose, 4 nose types
    if (nose == 1) { //button nose
        ellipse(width/2, height/2, .75 * cellWidth, .5 * cellHeight);
    } else if (nose == 2) { // big nose
        arc(width/2, height/2, cellWidth, .75 * cellHeight, PI + HALF_PI, TWO_PI + HALF_PI);
    } else if (nose == 3) { //downwards nose
        arc(width/2, height/2, .5 * cellWidth, .75 * cellHeight, 0, PI);
    } else { //skinny nose
        arc(width/2, height/2, cellWidth, .25 * cellHeight, PI + HALF_PI, TWO_PI + HALF_PI);
    }

//mouth, 4 types
    if (mouth == 1) { //expressionless mouth
        strokeWeight(5);
        line(2.5 * cellWidth, 5 * cellHeight, 3.5 * cellWidth, 5 * cellHeight);
    } else if (mouth == 2) {//open mouth
        fill(50);
        arc(3 * cellWidth, 5 * cellHeight, 1.25 * cellWidth, cellHeight, 0, PI, CHORD);
    } else if (mouth == 3) { //smirk
        noFill();
        strokeWeight(5);
        beginShape();
        curveVertex(3 * cellWidth, 5.25 * cellHeight);
        curveVertex(3 * cellWidth, 5.25 * cellHeight);
        curveVertex(3.3 * cellWidth, 5.20 * cellHeight);
        curveVertex(3.5 * cellWidth, 5 * cellHeight);
        curveVertex(3.5 * cellWidth, 5 * cellHeight);
        endShape();
    } else { //sad mouth
        strokeWeight(5);
        arc(3 * cellWidth, 5 * cellHeight, .75 * cellWidth, .5 * cellHeight, PI, TWO_PI);
    }
//beauty marks, 2 types
    if (faceDetail == 1) { //leftside
        strokeWeight(8);
        point(2.25 * cellWidth, 5 * cellHeight);
    } else if (faceDetail == 2) {//right side
        strokeWeight(8);
        point(4.25 * cellWidth, 4 * cellHeight);
    }
}
function mousePressed() {
//baracks to make random only do integars
    head = random([1, 2, 3]);
    ear = random([1, 2, 3, 4]);
    nose = random([1, 2, 3, 4]);
    mouth = random([1, 2, 3, 4]);
    hair = random([1, 2, 3, 4]);
//hair color randomizer
    color1 = random(0, 255);
    color2 = random(0, 255);
    color3 = random(0, 255);
//added extra integars to make beauty marks less frequent and only happen 1/4 of the time
    faceDetail = random([1, 2, 3, 4, 5, 6, 7, 8]);
}

Doing this project taught me a lot about the process of coding and fixing your code when it is wrong.

My Characters I created as inspiration

I first started off with a grandiose plan to make these 4 faces and then mix and match each part of each face so it muddles all the faces randomly. However, it was a lofty goal for the time I had.

My process of figuring out my grid system

This led me to settling but still constructing my code in a fully self-made variable grid structure, if statements, and using random() to choose between the the variants I created for each facial feature.

Additionally, I randomized the faces even more by making hair colors able to be whatever shade in RBG it desires.

Overall, I learned a lot of the simple powers of the random() function and I wish I could’ve added on more to this project.

Project 02: Variable Faces

jen project 02 sketch copy

//Jennifer Kim
//Class section: C

var eyeSize = 40;
var Type = 0;
var eyeWidth = 28;
var eyeHeight = 35;
var faceWidth = 275;
var pupilWidth = 40;
var pupilHeight = 30;
var faceHeight = 250;
var faceColorA = 0;
var faceColorB = 255;
var faceColor = 2;
var hairclipStyle = 0;

function setup() {
    createCanvas(480, 640);
}
 
function draw() {
    background(229,204,255);
    
    //hair
    fill(51,25,0);
    arc(240, 340, 300, 380, QUARTER_PI + HALF_PI, QUARTER_PI, OPEN);

    
    //face
    if (faceColor>1) {
       fill(255,229,204);
   } else if (faceColor<=1) {
       fill(241,200,124);
   }
    ellipse(width / 2, height / 2, faceWidth,  faceHeight);
    
    //eyes 
    fill(255);
    var eyeLX = width / 2 - faceWidth * 0.25;
    var eyeRX = width / 2 + faceWidth * 0.25;
    ellipse(eyeLX, height / 2, eyeSize, eyeSize);
    ellipse(eyeRX, height / 2, eyeSize, eyeSize);
    
    //pupils
    fill(153,76,0);
    ellipse(width/2-50,height/2,pupilWidth-15,pupilHeight-15);
    ellipse(width/2+50,height/2,pupilWidth-15,pupilHeight-15);
    
    //circle nose
    fill(241,194,125);
    ellipse(width/2,height/2+30,15,15);

    //straight mouth
    if (Type <= 1.25){ 
    fill(255,213,255);
    rect(width/2-25, height/2+60,50,5);
    
    //triangle nose
    } else if (Type <= 2.5){ 
    fill(241,194,125); 
    triangle(width/2 - 15, height/2 + 40, width/2 + 15, height/2 + 40, width/2, height/2);
    }
    
    //hair accessories
    if (hairclipStyle <= 0.8){ 
        fill(76,0,153);
        circle(width/3, height/3, 60); 
        circle(width - (width/3), height/3, 60);
        
    } else { //attempt at using curve vertex
        fill(76,0,153);
        beginShape(); 
        curveVertex(310, 280);
        curveVertex(350, 300);
        curveVertex(390, 250);
        curveVertex(290, 210);
        curveVertex(270, 310);
        endShape();
    }
}
 
function mousePressed() {
    faceWidth = random(220, 230);
    faceHeight = random(240, 250);
    eyeSize = random(30, 40);
    Type = random(0,3);
    pupilWidth=random(30,35);
    pupilHeight=random(30,35);
    faceColorA = random(30, 150);
    faceColorB = random(70,200);
    hairclipStyle = random(0, 3);
}

Figuring out how to shape and position with the curveVertex() was tricky, but I was eventually able to create what I was going for. It was also interesting to put my new knowledge from lecture about if/else statements to use.

Looking Out Post #2: Generative Art

The specific artwork that I am inspired by is “Timelapse” (2021) by Katherine Frazer. She has many fun and iterative art pieces but one specifically felt very fun and vibrant to me especially after a dull day.

A frame from the generative art “Timelapse”

From what I learned in an interview, Ms. Frazer enjoys to build upon her work in a sequential process of layering and allowing for changes happening on the go, which causes her to base a lot of decisions on intuition.

After learning this, I could see it very distinctly in her work, and it made me enjoy it more. I feel like art is often very intriguing and powerful when it flows naturally. It feels freeing to look at. I also greatly respect Ms.Frazer for embracing a process many get scared by or don’t believe in.

Lastly, I love the colors and flowers in this piece. It adds to the wildness while also not covering up the careful generative layering process.

Overall, it is simple but very intricate and I think that is a great take on generative art.

link to artwork and interview here