Shannon Ha – Project 03 – Dynamic Drawing

sketch

//Shannon Ha
//Section D
//sha2@andrew.cmu.edu
//Project - 03: Interactive Drawing

var diam1 = 50; //diameter of
var diam1a = 70;//
var speedcircle = 1;//speed of circle
var dir = 1;// direction of pulsing circle
var angle = 0; // angle of rotation
var speedangle = 0.2
var lineAX = 200;
var lineAX2 = 100
var lineAY = 175;
var diam2 = 135;
var diam3 = 200

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

}

//top-right ellipse
function draw() {
  background(0);
  fill(220, mouseX/2, mouseY/2);
  ellipse(70, 70, diam1, diam1);
    diam1 += dir * speedcircle/2;
    if(diam1 > 150){
      dir = -dir;
      diam1 = 150;
    }
    else if(diam1 < 0){
      dir = -dir;
      diam1 = 0;
    }

//mouse ellipse
  fill(0);
  push();
  ellipse(mouseX, mouseY, mouseX+1, mouseX+1);
    fill(246,mouseX,mouseY);

  //middle ellipse
  ellipse(200,240,diam2,diam2);

  diam2 += dir * (speedcircle + 2);

  if(diam2 > 300){
    dir = -dir;
    diam2 = 300;
  }
  else if(diam2 < 0){
    dir = -dir;
    diam2 = 0;
  }

//left-most ellipse
  ellipse(470,190,mouseX/2,mouseY/2);
  noStroke();
  fill(200,0,mouseX/2);
  if (mouseX/2 <= diam3/2){
    mouseX = 30;
  }

  if (mouseY/2 <= diam3/2){
    mouseY = 30;
  }

//spinning lines
  stroke(0,250,mouseY);
  strokeWeight(5);
  push();

  translate(mouseX, mouseY);
  rotate(mouseX/2 || mouseY/2);
  line(lineAX,lineAY,lineAX2,lineAY);
  line(lineAX+40,lineAY+40,lineAX2+40,lineAY+40);
  line(lineAX-50,lineAY-50,lineAX2-50,lineAY-50);
  line(lineAX-20,lineAY-20,lineAX2-20,lineAY-20);

  pop();






}

For this weeks project, I wanted to create a dynamic drawing that resembled fireworks, however, I struggled a lot to make the lines move, so I decided to simplify it to just ellipses instead.

Jina Lee – Project-03


For this assignment, I used a fish for my main theme. As the fish food gets closer to the bowl, the view zooms in. Also, the fish rotates  when the fish food gets closer to the bowl. The box tilts towards the fish bowl as soon as it hits the top of the fish bowl. In addition, as the mouse moves down, the background changes from dark to light. It took me a long time to understand how to use the if statements properly. I enjoyed this project. In the future, I want to be able have the fish bowl get bigger as the mouse moves. 

sketch

//Jina Lee
//Section E
//jinal2@andrew.cmu.edu
//Project-03

// variables
var fishX = 50;
var fishY = 20;
var fbX = 60;
var fbY = 90;
// background color
var rColor = 70;
var gColor = 70;
var bColor = 130;

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

function draw() {
    // background changes color as mouse moves up and down
    var rColor1 = min(mouseY + rColor, 244);
    var gColor1 = min(mouseY + gColor, 244);
    var bColor1 = min(mouseY + bColor, 150);
    // by manipulating rColor, gColor, and bColor based on mouseY position
    // background is random
    background(rColor1, gColor1, bColor1);

    // fishbowl
    noStroke();
    fill(131, 172, 219);
    // once the mouse is past 150 on y axis - the fish bowl gets bigger
    if (mouseY >= 200){
        ellipse(fbX * 4, fbY * 5, 450, 450);
        rect(fbX / 2, fbY * 2, fbX * 7, fbY + 50, 20);
    }
    // fishbowl when it is not past 150 on y axis
    ellipse(fbX * 4, fbY * 5, 350, 350);
    rect(fbX + 5, fbY * 3, fbX * 5.8, fbY + 10, 20);

    // goldfish body
    noStroke();
    fill(214, 135, 53);
    // what happens when mouse goes past 200 on y axis
    if (mouseY >= 200) {
        // movement of goldfish when mouse is past 200 on y axis
        push();
        // the fish gets bigger to seem like zooming in
        scale(1.2);
        // the fish starts moving away from the mouse
        rotate(radians(mouseY / 70));
        // goldfish body
        ellipse(fishX * 2.2, fishY * 15, 30, 15);
        ellipse(fishX * 3, fishY * 15, fishX * 1.5, fishX * 1.5);
        triangle(fishX * 3, fishY * 15, fishX * 3.5, fishY * 18, fishX * 2,
                 fishY * 18);
        // goldfish face
        noStroke();
        fill(94, 94, 94);
        ellipse(fishX * 3, fishY * 14, 10, 10);
        // goldfish scales
        noFill();
        stroke(94, 94, 94);
        strokeWeight(2);
        arc(fishX * 2.84, 315, 15, 15, PI, PI / 3);
        arc(fishX * 3.15, 320, 15, 15, PI, PI / 3);
        arc(fishX * 3.06, 306.2, 15, 15, PI, PI / 2);
        pop();
    }

    // what happens when mouse stays between 199 on y axis
    if (mouseY <= 199) {
        // goldfish stays still when mouse go stays between 199 on y axis
        noStroke();
        //goldfish body
        ellipse(fishX * 2.2, fishY * 20, 30, 15);
        ellipse(fishX * 3, fishY * 20, fishX * 1.5, fishX * 1.5);
        triangle(fishX * 3, fishY * 20, fishX * 3.5, fishY * 23, fishX * 2, fishY * 23);
        // goldfish face
        noStroke();
        fill(94, 94, 94);
        ellipse(fishX * 3, fishY * 19, 10, 10);
        // goldfish scales
        noFill();
        stroke(94, 94, 94);
        strokeWeight(2);
        arc(fishX * 2.82, 414, 15, 15, PI, PI / 3);
        arc(fishX * 3.1, 410, 15, 15, PI, PI / 3);
        arc(fishX * 3.07, 421, 15, 15, PI, PI / 2);
        pop();
    }

    // fishfood box
    //the fishfood box position is slightly slanted
    translate(mouseX - 70, mouseY - 150);
    rotate(-50, -50, 55, 55);
    // when the mouse goes past 200 on y axis - fishfood tilts the opposite way
    if (mouseY >= 200) {
        rotate(-26, -26, 0, 0);
        translate(5, 0);
        // fishfood pebbles show after mouse goes past 200 on y axis
        fill(94, 77, 54);
        ellipse(fbX / 2, fbY / 1.5, 20, 20);
        ellipse(fbX / 1.8, fbY, 20, 20);
        ellipse(fbX / 9, fbY, 20, 20);
    }

    // box
    noStroke();
    fill(176, 56, 55);
    rect(50, 40, 125, 200, 10, 10, 10, 10);
    // logo
    fill(94, 94, 94);
    rect(fbX, fbY + 10, 100, 30);
    rect(fbX, 140, fbX + 40, 90);
    fill(214, 135, 53);
    ellipse(fbX + 50, 180, 40, 40);
    triangle(fbX * 2, 190, 110, 210, 140, 200);
}

Sean Leo – Project 03 – Dynamic Drawing

I wanted to create an dynamic drawing that was minimal and focused more the on the composition and geometries of the basic shapes. Stopping your mouse anywhere on the canvas will produce a new composition, color and relation between all the parts. Also it’s really satisfying to just roll your mouse around on the canvas!

project-03

//Sean B. Leo
//Section C
//sleo@andrew.cmu.edu

//Project-03
function setup() {
    createCanvas(600, 480);
    strokeWeight(4);
  }
  
  function draw() {
    background(0);
    noFill();
    //scale mouse X value from 0-175
    var a = map(mouseX, 0, width, 0, 175);
    //scale mouse Y value from 0-175
    var b = map(mouseY, 0, height, 0, 175);
    //print(a);
    //contrary motion
    var inX = width - mouseX;
    var inY = height - mouseY;
    //rectangle transformations
    stroke(a, 0, 100);//scales R value
    rect(inX, inY, inX, inY);
    //circle transformations 
    stroke(100, a, b);//scales G B values
    ellipse(width/2, height/2, a, b);
    //triangle transformations
    stroke(0, a, 100);//scales G values
    triangle(width/2, mouseX / 2, mouseY / 2, mouseY / 2, mouseX, mouseY);
  }

Sean Leo – Looking Outwards 3

Fosters+Partners
Fosters+Partners

In looking up computational fabrication, I came across a lot of examples in architecture that features heavy parametric modeling. Without the aid of computers, certain shapes would be next to impossible to produce especially when all the requirements of architectural engineering need to be up held. Below is an example from Fosters+Partners for the new Mexcio City International Airport.

Curving structures and complex geometries create the exoskeleton for the airport and were modeled using digital methods.

Fosters+Partners

Sammie Kim-Project-03-Dynamic-Drawing

sketch

//Sammie Kim
//sammiek@andrew.cmu.edu
//Section D
//Project 3

//Global variables for default
var colorR = 0;
var colorG = 9;
var colorB = 48;
var angle1 = 0;
var angle2 = 0;

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

function draw() {
    //Changing background colorR as my mouse moves in the Y direction
    var colorR1 = min(colorR + mouseY, 173);
    var colorG1 = min(colorG + mouseY, 48);
    var colorB1 = min(colorB + mouseY, 63);
    background(colorR1, colorG1, colorB1);

    //Limit the mouse range, so the images don't go off the canvas
    mouseX = max(min(mouseX, 500), 0);

    //Y coordinates of the rectangle behind the circle
    var rectY = 480 - mouseY;
    var rect2Y = 0 + mouseY;

    fill("black");
    rectMode(CENTER);
    rect(320,rectY,140,300); //center rectangle
    rect(110,rect2Y,50,400); //left rectangle
    rect(530,rect2Y,50,400); //right rectangle

    //X locations of the circles
    var circAx = mouseX
    var circBx = mouseX - 40
    var circCx = mouseX - 20
    var circDx = mouseX-50

    //Changing the widths of the circles
    var circAw = mouseX - 80;
    var circBw = mouseX - 150;
    var circCw = mouseX * 0.5 - 30;
    var circDw = mouseX * 0.4;

    //Series of circles
    fill(mouseX, mouseY, 100);
    circAw = constrain(circAw, 90, 350); //constrain main circle size
    circle(circAx,240,circAw);//Big visible circle
    fill(colorR1, colorG1, colorB1);
    circle(circBx, 240, circBw); //Big hidden circle
    fill(mouseX, 200, mouseY);
    circle(circCx,240, circCw);//Small visible circle
    fill(colorR1, colorG1, colorB1);
    circle(circDx,240, circDw); //Small hidden circle

    //Changing size of the rotating squares
    var rectSize = mouseY * 0.2;
    var rectSize2 = mouseY * 0.1

    //Rotating square
    fill(253, 242, 216);
    noStroke();
    push();
    translate(mouseX,240);
    rotate(radians(angle1));
    rectMode(CENTER);
    rect(100,100,rectSize,rectSize);
    pop();
    angle1= angle1 + 2;

    //Second rotating square
    fill(126, 211, 216);
    push();
    translate(mouseX,300)
    rotate(radians(angle2));
    rectMode(CENTER);
    rect(120,100,rectSize2,rectSize2);
    pop();
    angle2 = angle2 + 2
  }

This project was challenging in many aspects; I had to think about the shape’s coordinates in relation to the mouse location and constrain them so that they don’t leave the canvas. I was able to apply a lot of the knowledge I gained from the lab exercises with rotating squares and the lecture about creating movement. Overall, this project prompted me to be both creative and logical.

Janet Peng Project 02 – Variable Face

jjpeng assignment 2

var faceWidth = 120;
var faceHeight = 100;
var earRotation = 20;
var eyeSize = 10;
var cheekSize = 10;
var r = 244;
var g = 235;
var b = 130;

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

function draw() {
	background (255, 255, 220);

	// face
	fill(r, g, b);
	stroke(r, g, b);
	ellipse(width / 2, height / 2, faceWidth, faceHeight);

	// right ear
	push();
	translate(width / 2 + faceWidth / 3, height / 2 - faceHeight / 2);
	rotate(radians(earRotation));
	fill(r, g, b);
	stroke(r, g, b);
	ellipse(0, 0, 20, 70)
	fill(60);
	stroke(60);
	arc(0, 0, 20, 70, PI + 1.2, 2 * PI - 1.2, OPEN)
	pop();

	// left ear
	push();
	translate(width / 2 - faceWidth / 3, height / 2 - faceHeight / 2);
	rotate(radians(-earRotation));
	fill(r, g, b);
	stroke(r, g, b);
	ellipse(0, 0, 20, 70)
	fill(60);
	stroke(60);
	arc(0, 0, 20, 70, PI + 1.2, 2 * PI - 1.2, OPEN)
	pop();

	// eyes
	fill(60);
	stroke(60);
	ellipse(width / 2 - faceWidth / 4, height / 2, eyeSize, eyeSize)
	ellipse(width / 2 + faceWidth / 4, height / 2, eyeSize, eyeSize)

	// nose
	fill(60);
	stroke(60);
	triangle(width / 2 - faceWidth / 35, height / 2 + faceHeight / 20,
			 width / 2 + faceWidth / 35, height / 2 + faceHeight / 20,
			 width / 2, height / 2 + faceHeight / 12,);

	// cheeks
	fill(247, 98, 52);
	stroke(247, 98, 52);
	ellipse(width / 2 - faceWidth / 2.8, height / 2 + faceHeight / 6, cheekSize, cheekSize)
	ellipse(width / 2 + faceWidth / 2.8, height / 2 + faceHeight / 6, cheekSize, cheekSize)

	// hat
	fill(58, 53, 50);
	stroke(58, 53, 50);
	arc(width / 2, height / 2 - faceHeight / 2.3, 45, 40, PI, 0);
	ellipse(width / 2, height / 2 - faceHeight / 1.6, 6, 4);
	fill(84, 79, 74);
	stroke(84, 79, 74);
	ellipse(width / 2, height / 2 - faceHeight / 2.3, 40, 10);
}

function mousePressed() {
    // on click variables are randomly reassigned
    faceWidth = random(100, 150);
    faceHeight = random(100, 120);
    earRotation = random (5, 60);
    eyeSize = random(5, 20);
    cheekSize = random(5, 20);
    r = random (230, 255);
    g = random (215, 235);
    b = random (110, 130);
}

Bo Yang– Project 03 – Dynamic Drawing

sketch

/*
    Bo Yang
    Section A
    byang2@andrew.cmu.edu
    Project-03-Dynamic-Drawing
*/

var angle1 = 0;
var angle2 = 0;
var angle3 = 0;
var angle4 = 0;
var position = 0;


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

function draw() {
    //background changes color from black to white
    background(mouseX, mouseY);
    noStroke(0);

    //rotating rectangle
    push();
    translate(200, 200);
    rotate(radians(angle2));
    fill(200, mouseX, mouseY);
    rectMode(CENTER);
    rect(0, 0, mouseX, mouseY - 20);
    pop();
    angle2 = angle2 + 5;

    //rotating rectangle
    push();
    translate(180, 180);
    rotate(radians(angle3));
    fill(mouseX, mouseY, 255);
    rect(0, 0, mouseX + 20,  mouseY);
    pop();
    angle3 = angle3 + 15;

    //rotating black ellipse
    push();
    translate(width / 2, height / 2);
    rotate(radians(angle4));
    fill(0);
    ellipse(0, 0, mouseX, mouseY);
    pop();
    angle4 = angle4 + 30;
    

    //rotating ellipse
    push();
    translate(width - 50, height - 50);
    rotate(radians(angle1));
    fill(random(0, 255), random(0, 255), random(0, 255));
    ellipseMode(CORNER);
    ellipse(position, 0, mouseX, mouseY);
    pop();
    position = position + 1; 
    angle1 = angle1 + 10;

}

This is my Dynamic Drawing. To be fancy, I make them all can change colors. The background can change colors from black to white when you moving your mouse. And the two rectangles also can change color, one is blue, the other is red. And also, when you moving your mouse, it can also change size. The two ellipses, one is black and cannot change color. The other one can change all the colors by itself.

Monica Chang – Project 03 – Dynamic Drawing

Suggestion: move cursor in circular motions around the canvas.

sketch

//Monica Chang
//Section D
//mjchang@andrew.cmu.edu
//Project-03

var angle = 0;
var x = 0;

function setup() {
  createCanvas(640, 480);
  noStroke();
  rectMode(CENTER);

  
}
function draw() {


  
// changing color of background as mouse moves around canvas.
  background(mouseX, mouseY, 245); 
  
//mouseX controls x location
  fill(255, 150);
  ellipse(mouseX, mouseY, mouseY, mouseY);
// mouseY controls y location AND size
  fill(0, 159);
  ellipse(width - mouseX, mouseY, height - mouseY, height - mouseY);

//spiraling circle meant to indicate how to move your mouse around and play with it.
  print(x);
  push();
  translate(width/2,height/2);
  rotate(radians(angle));
  fill("red");
  ellipse (x ,0,50,50);
  pop();
  angle = angle +5;
  x = x + 0.5;
  //sending spiral circle return to center and then draw again>

  if (x == 300){
    x = 0;
  }


}

I wanted to explore the use of depth perception within this piece by playing with the size and position. I also integrated what we learned in recitation where we created a spiral; however, I wanted to take it to another level by drawing it continuously while it redraws in a different position. Once it hits the edge of the canvas I wanted the spiral movement to continue again from the center. I struggled to get it to move smoothly but I am still happy with the results.

Mihika Bansal – Project 03 – Dynamic Drawing

sketch

/*
Mihika Bansal 
Section E 
mbansal@andrew.cmu.edu
Project-01
*/
var angle1 = 0; //rotates one direction
var angle2 = 0; //rotates the other direction
var rgb1 = 0; //random color generator 1
var rgb2 = 0; //random color generator 2
var dimension = 20; //size of elements
function setup() {
    createCanvas(600, 480);
  }

function draw() {

    rgb1 = random(0, 300); //randomizing here creates the flashing effect 
    rgb2 = random(0,275); 
    dimension = random(5, 60);
    
    if (mouseX < width / 2) { //determine if the mouse is on the left of the canvas 
        background(0, 0, 51);
        push();
        rotate(radians(angle1)); //creating the rows of shapes in the top left corner
        fill(rgb1 * 0.2, rgb2 * 0.5, rgb1 * 0.8); // the multiplication randomizes the color more
        rect(mouseY * 0.8, mouseY * 0.5, dimension, dimension);
        fill(rgb2 * 0.5, rgb2 * 0.3, rgb1 * 0.6); 
        ellipse(mouseY * 0.3, mouseY * 0.2, dimension, dimension); //the distance from the rotation point is dependent on the position of mouse y 
        fill(rgb1 * 0.85, rgb2 * 0.9, rgb1 * 0.7);
        ellipse(mouseY, mouseY, dimension * 1.5, dimension * 1.5); 
        fill(rgb1 * 0.7, rgb2 * 0.65, rgb1 * 0.7);
        rect(mouseY * 1.3, mouseY * 1.3, dimension * 2, dimension * 2);
        pop();
        angle1 += 2; 

        push(); 
        translate(width - 5, height - 5); //creating the line of shapes in the bottom right corner
        rotate(radians(angle2));
        fill(rgb1 * 0.2, rgb2 * 0.5, rgb1 * 0.8);
        rect(mouseY * 0.8, mouseY * 0.5, dimension, dimension);
        fill(rgb2 * 0.5, rgb2 * 0.3, rgb1 * 0.6); 
        ellipse(mouseY * 0.3, mouseY * 0.2, dimension, dimension); 
        fill(rgb1 * 0.85, rgb2 * 0.9, rgb1 * 0.7);
        ellipse(mouseY, mouseY, dimension * 1.5, dimension * 1.5); 
        fill(rgb1 * 0.7, rgb2 * 0.65, rgb1 * 0.7);
        rect(mouseY * 1.3, mouseY * 1.3, dimension * 2, dimension * 2);
        pop(); 
        angle2 -= 2; 
    }
    else { //when mouse is on right of screen
        background(77, 0, 0);
        push();
        rotate(radians(angle1));
        fill(rgb1 * 0.25, rgb2 * 0.4, rgb1 * 0.71);
        rect(mouseY * 0.8, mouseY * 0.57, dimension, dimension);
        fill(rgb2 * 0.5, rgb2 * 0.3, rgb1 * 0.6); 
        ellipse(mouseY * 0.3, mouseY * 0.2, dimension, dimension); 
        fill(rgb1 * 0.8, rgb2 * 0.9, rgb1 * 0.7);
        ellipse(mouseY, mouseY, dimension * 1.5, dimension * 1.5); 
        fill(rgb1 * 0.7, rgb2 * 0.65, rgb1 * 0.7);
        rect(mouseY * 1.3, mouseY * 1.3, dimension * 2, dimension * 2);
        pop();
        angle1 -= 2; 

        push(); 
        translate(width - 5, height - 5);
        rotate(radians(angle2));
        fill(rgb1 * 0.2, rgb2 * 0.54, rgb1 * 0.8);
        rect(mouseY * 0.86, mouseY * 0.5, dimension, dimension);
        fill(rgb2 * 0.5, rgb2 * 0.35, rgb1 * 0.64); 
        ellipse(mouseY * 0.3, mouseY * 0.2, dimension, dimension); 
        fill(rgb1 * 0.85, rgb2 * 0.9, rgb1 * 0.7);
        ellipse(mouseY, mouseY, dimension*1.5, dimension * 1.5); 
        fill(rgb1 * 0.77, rgb2 * 0.65, rgb1 * 0.7);
        rect(mouseY * 1.3, mouseY * 1.3, dimension * 2, dimension * 2);
        pop(); 
        angle2 += 2; // changes angle 
       
    }

}



With this piece I worked with direction of the rotation being dependent on the position of the mouse. I also made the distance of each element dependent on the y position of the mouse. This project was interesting and helpful in understanding the random function and the rotation function.

Janet Peng – Looking Outwards – 01

Imagination Playground in Play Work Build. Children stand in front of a projection and get their silhouettes turned into a block figure. When they move, the blocks tower explodes/topples.

Play Work Build is an exhibit in The National Building Museum in Washington, DC. The exhibit is about the history of construction and block-based toys. It includes the Imagination Playground; a very unique way children can interact with (and destroy) building blocks (by standing and moving in front of a screen). I find this project inspiring because it revolutionizes the idea of playing this block which is a very old-school and non-techy-y activity. This project reinvents the toy and makes something that could be seen as boring seem interesting. I believe this project required the team at the rockwellgroup to write custom scripts that allows the projection to randomly generate block forms depending on the size and position of the person interacting with the projection. The creators were probably inspired by other interactive exhibit designs that use motion tracking to turn gestures into visual experiences.