Project 06: Abstract Clock

sketch
//Anthony Pan
//Section C

var d = 0; //diameter for 24 hr circles
var d1 = 0; //diameter for 24 hr circles
//var d2; //first circle diameter
//var d3; //first cirlce diameter

var c1 = []; //color array for the 24 hrs of a day
var hours = []; //hours in a day

function setup() {
    createCanvas(480, 480);
    for(var i = 0; i <= 23; i++) {
        hours[i] = i;

        if(i >= 0 & i <= 8){
            c1[i] = color(0, random(256), random(256)); //random green + blue, no red first 8 hrs
        }

        if(i > 8 & i <= 16) {
            c1[i] = color(random(256), 0 , random(256)); //random red + blue, no green between 8-16 hrs

        }

        if(i >16 & i<=23) {
            c1[i] = color(random(256), random(256), 0); //random red + green, no blue 16-24 hrs 

        }

    }

}



function draw() {
    background(0);
    draw_circle(d, d1);
    //fill_circle(d2, d3);

    noStroke();
    fill(c1[hour()]); //fill color based on the hour

    //draw a circle that grows based on the number of minutes that has passed
    ellipse(240, 240, 20*hour() + minute()/3, 20*hour() + minute()/3); 

    //display clock
    textSize(15);
    strokeWeight(1);
    fill(255);
    text(hour() + ":" + minute() + ":" + second(), 10, 470); //display time on 24 hr clock at bottom left corner
   
}

function draw_circle(d, d1){
    for(var i = 1; i <= 25; i++) {
        noFill();
        stroke(255); //create why circle stroke
        ellipse(240, 240, d, d1); //create 24 concentric cirlces for 24 hrs in a day
        d += 20; 
        d1 += 20; //d and d1 grow each cirlce's radius

    }

}


//process for creating fill circle
/*
function fill_circle(d2, d3) { //fill circle based on minute
    for(var i = 0; i <= hour(); i++) {
        noStroke();
        fill(c1[hour()]); //fill color based on the hour
        ellipse(240, 240, 10*hour() + d2*minute(), 10*hour() + d3*minute());

        d2 += 1/6; //rate of growth based on time /proportions
        d3 += 1/6;
        print(d2);
    }
}
*/

/*
function fill_circle(d2, d3) { //fill circle based on minute
    noStroke();
    fill(c1[hour()]); //fill color based on the hour
    ellipse(240, 240, 20*hour() + minute()/3, 20*hour() + minute()/3);
    
}

/*
function draw_circle(d, d1){
    for(var i = 0; i <= 23; i++) {
        noFill();
        stroke(255);
        ellipse(240, 240, d, d1); //create 24 concentric cirlces for 24 hrs in a day
        d += 20;
        d1 += 20; //d and d1 grow each cirlce's radius

    }


}
*/

/*
function fill_circle(d2, d3) { //fill circle based on minute
    for(var i = 0; i <= minute(); i++) {
        noStroke();
        fill(c1[hour()]); //fill color based on the hour
        ellipse(240, 240, d2, d3);
        d2 += 0.33; //rate of growth based on time /proportions
        d3 += 0.33;

    }

}
*/

Project Description:

This clock has 24 concentric circles representing the 24 hours in a day. A second function creates a circle that is filled with a random color based on the range of time: 0-8, 8-16, and 16-24. The circle fills the concentric circles slowly, growing based on each minute passed. There is a display of the time on a 24-hour clock at the bottom of the canvas to show the exact time as the circle fills the concentric circles very slowly.

Process/Ideation:

This was some of my process working on creating this clock.

Looking Outwards-05: 3D Computer Graphics

This week, I took a look at Daniel Danielsson, a graphic motion designer who has worked for a number of independent clients. I wanted to dive deeper into his work with About Time, a design agency with the goal of creating delightful experiences. The motion graphic he created for their rebranding was a series of different interactions revolving around a small ball; it is passed around this joyful mechanism that alters the ball using various interactions and colors to create a very warming and positive experience. I found this work really interesting because the animation does its job of communicating About Time’s rebranding initiative so well with a relatively simple animation. There isn’t a lot happening on the screen that it becomes overwhelming, but it stays engaging as you follow the entire experience of the ball. Everything is very refined, smooth, and sleek.

Daniel Danielsson The X

Project 5: Wallpaper

sketch
//Anthony Pan
//Section C


function setup() {
    createCanvas(400, 600);
}

function draw() {
    var dx = 0; 
    var dy = 0;
    var dx1 = 0;
    var dy1 = 0;
    background(232, 249, 255); //sky blue background
    branches(dx, dy); //call branches function inputing dx and dy to create pattern
    cherryBlossom(dx1, dy1); //call cherryBlossom function to create 6 flowers on each branch


    noLoop();
}


function branches(dx, dy) {
    strokeWeight(3);
    stroke(0);

    for(var column = 0; column < 10; column += 1) {
        
        for(var row = 0; row < 9; row +=1) {
            line(50 + dx, 55 + dy, 55 + dx, 85 + dy); //bottom of main branch
            line(35 + dx, 40 + dy, 50 + dx, 55 + dy); //middle of main branch
            line(10 + dx, 20 + dy, 35 + dx, 40 + dy); //top of main branch
            line(15 + dx, 35 + dy, 35 + dx, 40 + dy); //small branch below top main branch
            line(15 + dx, 5 + dy, 25 + dx, 32 + dy); //small branch above top main branch
            line(55 + dx, 20 + dy, 45 + dx, 50 + dy); //small branch right of middle main branch
            line(60 + dx, 35 + dy, 50 + dx, 40 + dy); //smallest branch right of middle main
            dy += 65; 
        }
        dx += 80;
        dy = 0;
    }
    
}

function cherryBlossom(dx1, dy1) {
    strokeWeight(1);
    var color = random(120, 230); //random shade of pink - yellow 
    var color1 = random(120, 230); //random shade of pink - yellow
    var color2 = random(120, 230); //random shade of pink - yellow
    var r = 8; //radius of outer petals 
    var r1 = 4; //radius of center petal

    for(var c = 0; c < 10; c += 1) {
        for(var row1 = 0; row1 < 9; row1 += 1) {
            fill(252, color, 174); //pink fill for flowers random shades of pink
            ellipse(15 + dx1, (10 - r1) + dy1, r, r); //top petal
            ellipse((15 + r1) + dx1, 10 + dy1, r , r); //right petal
            ellipse(15 + dx1, (10 + r1) + dy1 , r, r); //bottom petal
            ellipse((15 - r1) + dx1, 10 + dy1, r, r); //left petal

            fill(252, 174, 174);
            ellipse(15 + dx1, 10 + dy1, r1, r1); //center petal

            fill(252, color1, 174);
            ellipse(25 + dx1, (25 - r1) + dy1, r, r);
            ellipse((25 + r1) + dx1, 25 + dy1, r, r);
            ellipse(25 + dx1, (25 + r1) + dy1, r, r);
            ellipse((25 - r1) + dx1, 25 + dy1, r, r);

            fill(252, 174, 174);
            ellipse(25 + dx1, 25 + dy1, r1, r1); //center petal

            fill(252, color2, 174);
            ellipse(11 + dx1, (35 - r1) + dy1, r, r);
            ellipse((11 + r1) + dx1, 35 + dy1, r, r);
            ellipse(11 + dx1, (35 + r1) + dy1, r, r);
            ellipse((11 - r1) + dx1, 35 + dy1, r, r);

            fill(252, 174, 174);
            ellipse(11 + dx1, 35 + dy1, r1, r1); //center petal

            fill(252, color, 174);
            ellipse(40 + dx1, (40 - r1) + dy1, r, r);
            ellipse((40 + r1) + dx1, 40 + dy1, r, r);
            ellipse(40 + dx1, (40 + r1) + dy1, r, r);
            ellipse((40 - r1) + dx1, 40 + dy1, r, r);

            fill(252, 174, 174);
            ellipse(40 + dx1, 40 + dy1, r1, r1); //center petal

            fill(252, color1, 174);
            ellipse(55 + dx1, (20 - r1) + dy1, r, r);
            ellipse((55 + r1) + dx1, 20 + dy1, r, r);
            ellipse(55 + dx1, (20 + r1) + dy1, r, r);
            ellipse((55 - r1) + dx1, 20 + dy1, r, r);

            fill(252, 174, 174);
            ellipse(55 + dx1, 20 + dy1, r1, r1); //center petal

            fill(252, color2, 174);
            ellipse(60 + dx1, (35 - r1) + dy1, r, r);
            ellipse((60 + r1) + dx1, 35 + dy1, r, r);
            ellipse(60 + dx1, (35 + r1) + dy1, r, r);
            ellipse((60 - r1) + dx1, 35 + dy1, r, r);

            fill(252, 174, 174);
            ellipse(60 + dx1, 35 + dy1, r1, r1); //center petal

            dy1 += 65;

        }
        dx1 += 80;
        dy1 = 0; //reset dy1 when it hits bottom of column 
    }

    











    



}

Project 4: String Art

sketch
//Anthony Pan
//Section C
var dx1;
var dy1;
var dx2;
var dy2;
var dx3;
var dy3;
var dx4;
var dy4; 
var dx5;
var dy5;
var dx6;
var dy6;
var dx7;
var dy7;
var dx8;
var dy8;
var dx9;
var dy9;
var dx10;
var dy10;
var dx11;
var dy11;
var dx12;
var dy12;
var dx13;
var dy13;
var dx14;
var dy14; 

var numLines = 30;


function setup() {
    createCanvas(400, 300);
    background(0);

    //left of circle change in x/y
    dx1 = (280)/numLines;
    dy1 = (70)/numLines;
    dx2 = (120)/numLines;
    dy2 = (150)/numLines;

    //top of circle change in x/y
    dx3 = (150)/numLines;
    dy3 = (320)/numLines;
    dx4 = (90)/numLines;
    dy4 = (90)/numLines;

    //top right of circle change in x/y
    dx5 = (250)/numLines;
    dy5 = (20)/numLines;
    dx6 = (40)/numLines;
    dy6 = (150)/numLines;

    //bottom of circle change in x/y
    dx7 = (70)/numLines;
    dy7 = (120)/numLines;
    dx8 = (20)/numLines;
    dy8 = (300)/numLines;

    //right of circle change in x/y
    dx9 = (220)/numLines;
    dy9 = (120)/numLines;
    dx10 = (80)/numLines;
    dy10 = (150)/numLines;

    //bottom right of circle change in x/y
    dx11 = (240)/numLines;
    dy11 = (10)/numLines;
    dx12 = (105)/numLines;
    dy12 = (60)/numLines;

    //bottom left of circle change in x/y
    dx13 = (80)/numLines;
    dy13 = (140)/numLines;
    dx14 = (20)/numLines;
    dy14 = (300)/numLines;


}

function draw() {
    //ellipse(width/2, height/2, 120, 120) //ellipse for reference

    //left of circle start points
    var x1 = 130;
    var y1 = 5;
    var x2 = 130;
    var y2 = 230;

    //top of circle start points
    var x3 = 0;
    var y3 = 100;
    var x4 = 250;
    var y4 = 85;

    //top right of circle start points
    var x5 = 273;
    var y5 = 5; 
    var x6 = 273;
    var y6 = 230;

    //bottom of circle start points
    var x7 = 125;
    var y7 = 210;
    var x8 = 400;
    var y8 = 210;

    //right of circle start points
    var x9 = 220;
    var y9 = 40;
    var x10 = 280;
    var y10 = 180;

    //bottom right of circle start points
    var x11 = 240;
    var y11 = 10;
    var x12 = 270;
    var y12 = 210;

    //bottom left of circle start points
    var x13 = 160;
    var y13 = 200;
    var x14 = 230;
    var y14 = 220;


    for (var i = 0; i <= numLines; i += 1) { 
        stroke(220, 20, 0);

        //creating red vortex around a circle

        line(x1, y1, x2, y2); //left of circle
        x1 += dx1;
        x2 -= dx2;
        y1 += dy1;
        y2 -= dy2;

        line(x3, y3, x4, y4); //top of cirlce
        x3 -= dx3;
        y3 -= dy3;
        x4 += dx4;
        y4 += dy4;

        line(x5, y5, x6, y6); //top right of circle  
        x5 -= dx5;
        y5 += dy5;
        x6 += dx6;
        y6 -= dy6;

        line(x7, y7, x8, y8); //bottom of circle
        x7 -= dx7;
        y7 -= dy7;
        x8 += dx8;
        y8 += dy8;

        line(x9, y9, x10, y10); //right side
        x9 += dx9;
        y9 -= dy9;
        x10 -= dx10;
        y10 += dy10;

        line(x11, y11, x12, y12); //bottom right
        x11 += dx11;
        y11 -= dy11;
        x12 -= dx12;
        y12 += dy12;

        line(x13, y13, x14, y14); //bottom left
        x13 -= dx13;
        y13 -= dy13;
        x14 += dx14;
        y14 += dy14;

    }

    noLoop();

}





    

Creating a vortex around an ellipse using string art

Looking Outwards 04: Sound Art

Today I took a look at Unity’s music visualization program done by Peer Play. They created something that I found very intriguing because it was a refreshing take on traditional music visualization, utilizing small dots to create movement according to the beats of the music. The different colors keep the artwork lively and engaging as you follow along with the spinning movement of the small dots. It feels like a miniature light show on a display! I think that one way they were able to sync the movements of the lights with the music was to have certain lights assigned to certain instruments. The change in volume of the instrument would subsequently change the direction and movement of the light. However, there are so many movements that it’s hard to understand what each specific movement is assigned to!

Peer Play Unity Music Visualization

Project 3: Dynamic Drawing

sketch
//Anthony Pan
//Section C
var size;
var colorRect; 
var wave;

function setup() {
    createCanvas(600, 450);
}

function draw() {
    scale(0.5); //zoom out
    translate(300, 200); //moves origin of canvas
    background(0);
    fill(255,0,0); //fills rectangles red
    rotate(radians(30)); //rotates canvas clockwise 30 degrees 
    mouseX = constrain(mouseX, 20, width); //constraining mouseX to canvas
    mouseY = constrain(mouseY, 0, height - 100); //constraining mouseY to canvas
    

    //rectangles created with for loop because of repeating pattern.
    for (let x = 0; x < 100; x++) {
        //initial rectangle 
        var position1 = (750 - 15 * x) + 200;
        var position2 = (-300 + x * 10) - 200;
        var rectWidth = 10;
        var rectHeight = 120;

        // size (further away from mouse, longer rectangle gets)(mouseX)
        size = dist(mouseX, 0, position1, position2); 
        position2 -= size/2; 
        rectHeight += size;

        //color (mouseY)
        //distance of mouseY from each rectangle gives color a value
        color = dist(0, mouseY, position1, position2); 
        //color creates a gradient from red to white
        color = (color/2.8 - 150) % 510
        //color = abs(255 - (color % 510)); // used so that there is a smooth transition from red to white to red again.
        fill(255, color, color);

        //wave (mouseX)
        wave = sin((PI/7) * x); //shifts the position of rectangles into a sin() wave
        position2 += wave * mouseX/3; //adjusting posiition based off of mouseX/3

        //twist (mouseY)
        rotate(radians(mouseY/100)); //reduces sensitivity of mouseY, also rotates canvas based on position of mouseY

        rect(position1, position2, rectWidth, rectHeight); //draws rectangle

    }
}

Using a for loop, I was able to create a rectangle and iterate it multiple times without having to repeatedly create every rectangle.

mouseX controls the size/length and the position of each rectangle through a sin() wave function as you move from left to right.

mouseY controls the color gradient from red to white as you move from top to bottom of the canvas. It also controls the rotation of the canvas.

Looking Outwards 03: Computational Fabrication

Today, I took a look at Project Aguahoja, a project done by the MIT media lab. The main focus of this project is waste reduction. Because so much of what we create ends up being waste, never to be used again, MIT media lab started a project where the grown and the made unite. They “aim to subvert the industrial, vicious cycle of material extraction and obsolescence through the creation of biopolymer composites that exhibit tunable mechanical and optical properties, and respond to their environments in ways that are impossible to achieve with their synthetic counterparts”. This is achieved through three parts, but I wanted to focus on the software and wetware designed by the Mediated Matter group. The Aguahoja Pavillion 1 can be programmed to degrade in water. This was especially inspiring to me because sustainability and technology can be mutually beneficial, and this project captures exactly that. The different structures that Aguahoja Pavillion 1 is made of are 3D printed from biomaterials and closely resemble natural structures. They didn’t disclose the programming used to create the structures, but I would have to guess that they used a series of equations to create a procedurally generated structure.

Project Aguahola

Project 2: Variable Face

sketch
//Anthony Pan
//Section C
//Simple beginning template for variable face.
var eyeSize = 20;
var faceWidth = 100;
var faceHeight = 150;
var nose1 = 140;
var nose2 = 180;
var nose3 = 150;
var nose4 = 165;
var nose5 = 155;
var nose6 = 170;
var mouth = 1;
var hair = 1;
var color = 1;

function setup() {
    createCanvas(300, 300);
}

function draw() {
    background(180);
    if (hair < 0.33){
        //hair middle
        line(width/2, height/2, width/2, height/2 - 2/3*faceHeight);
    }if (hair < 0.66){
        //hair right
        curve(width/2, height/2, width/2 + 25, height/2 - 1/3*faceHeight,
         width/2 + 50, height/2 - 1/2*faceHeight, width/2 + 75, height/2 - 3/4*faceHeight);
    }if (hair < 1){
        //hair left
        curve(width/2, height/2, width/2 - 25, height/2 - 1/3*faceHeight, 
        width/2 - 50, height/2 - 1/2*faceHeight, width/2 - 75, height/2 - 3/4*faceHeight);
    }
    if (color < 0.25){
        //pastel red face
        fill(235,136,129);
    }else if(color < 0.5){
        //pastel blue face
        fill(129, 219, 235);
    }else if (color < 0.75){
        //pastel green face
        fill(181, 245, 176);
    }else{
        //white face
        fill(255,255,255);
    }
    ellipse(width / 2, height / 2, faceWidth,  faceHeight);
    var eyeLX = width / 2 - faceWidth * 0.25;
    var eyeRX = width / 2 + faceWidth * 0.25;
    fill(255,255,255); //keeps features white
    ellipse(eyeLX, height / 2, eyeSize, eyeSize);
    ellipse(eyeRX, height / 2, eyeSize, eyeSize);
    if (mouth < 0.33){ 
        //happy mouth
        arc(150, 180, 20, 20, 0, PI + QUARTER_PI, CHORD);
    }else if (mouth < 0.66) {
        //sad mouth
        noFill(); //keeps mouth white
        curve(130, 200, 145, 185, 160, 185, 175, 200);
    }else {
        //neutral mouth
        line(140, 190, 170, 190);
    }
    fill(255,255,255); // keeps nose white
    triangle(nose1, nose2, nose3, nose4, nose5, nose6); //triangular nose with random coordinates

    

}

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.
    faceWidth = random(75, 150);
    faceHeight = random(100, 200);
    eyeSize = random(10, 30);
    nose1 = random(145, 150);
    nose2 = random(180, 190);
    nose3 = random(150, 155);
    nose4 = random(165, 170);
    nose5 = random(155, 160);
    nose6 = random(170, 180);
    mouth = random(0,1);
    hair = random(0,1);
    color = random(0,1);
    console.log(mouth);




}

LO 02: Generative Art

This week, I took a look at Karl Sims and his piece, Seven Experiments in Procedural Animation 2018. I found this piece very inspiring because of its beautiful renderings. The movements of the different experiments feeling natural, smooth, and organic. But they also have an artificial touch to them as they are computer-generated renderings in the first place. I admired the clean yet sophisticated forms he produced using mathematical equations. It’s strange to me to think that beauty can be derived from an equation: quantifying beauty in a sense. It is stated that he is using fractal equations, procedural noise, and reaction-diffusion techniques to create his visuals in this piece. Sims’ goal was to create an algorithm/visual piece that mimicked living organisms and microscopic structures that would evoke a biological aesthetic. Clearly, he was able to achieve what he set out to do, illustrated by the very fine movements and organic forms he incorporated into his work.

Karl Sims Seven Experiments in Procedural Animation

Project 1: My Self Portrait

sketch
function setup() {
    createCanvas(400,600);
    background(255);
}

function draw() {
    fill(166,196,255);
    rect(0,0,399,599);
    fill(255,238,189);
    rect(235,280,35,300);
    ellipse(250,280,200,270);
    fill(255,255,255);
    circle(200,220,50);
    circle(300,250,80);
    fill(0,0,0);
    circle(190,220,15);
    circle(280,250,15);
    fill(247,126,148);
    arc(250, 280, 80, 80, 0, PI + QUARTER_PI, CHORD);
    fill(0,0,0);
    triangle(160,140,180,190,250,145);
    triangle(200,150,220,100,275,155);
    triangle(250,150,280,120,300,165);
    triangle(290,160,310,140,330,200);
    fill(0,0,0);
    rect(225,500,80,199);
    noLoop();
    

}