karinac-Project-03

karinac-Project-03

//Karina Chiu
//Section C
//karinac@andrew.cmu.edu
//Project-03

var bgRed = 0;
var bgGreen = 0;
var bgBlue = 64;


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



function drawSky() {

	//background color changes using mouse movement

   	background(bgRed,bgGreen,bgBlue);

   	var bgX = mouseX
    
   	//day time bgcolor(187,228,248)
	if (bgX > 200 & bgX < 400) {
		bgX = 200
	}

    //transition to night time
    if (bgX >= 400) {
		bgX = 200 - (mouseX-400)
	}



	//day time transition to blue
	//bgcolor(187,228,248)
	//200 is the starting point of blue sky

	bgRed = bgX*((187-0)/200) + 0;
	bgGreen = bgX*((228-0)/200) + 0;
	bgBlue = bgX*((248-64)/200) + 64;



	//call drawSky function
	window.setInterval(drawSky, 100);
}



function draw() {

	//sun

	var sunSize = 0.4*mouseX
	var sunX = mouseX
	//parametric equation for path of sun
	var sunY = 80 + 0.0033*Math.pow(sunX-300,2)


	if (sunX <= 50) {
		sunX = 50
	}

	if (sunX >= 550) {
		sunX = 550
	}


	fill(255,201,14);
	noStroke();
	ellipseMode(CENTER);
	ellipse(sunX,sunY,sunSize,sunSize);





	//skyline

	fill(0);
	noStroke();

	//left buildings
	rect(0,height-200,45,200);
	rect(50,height-250,75,250);
	rect(55,height-260,65,10);
	rect(60,height-270,55,10);
	rect(65,height-280,45,10);

	//disproportionate building - right
	triangle(475,height-220,525,800,575,height-200);
	triangle(482,height-240,525,650,570,height-260);
	triangle(487,height-280,525,500,562,height-270);

	//dome building
	rect(150,height-110,200,110);
	rect(160,height-125,180,125);
	rect(165,height-130,170,130);
	ellipseMode(CENTER);
	ellipse(250,height-130,160,130);
	rect(240,height-198,20,10);
	rect(248,170,5,100);

	//bottom skyline
	rect(0,height-150,100,150);
	rect(100,height-100,100,100);
	rect(350,height-220,70,220);
	rect(380,height-300,50,325);
	rect(420,height-200,20,200);
	rect(440,height-120,60,120);
	rect(520,height-150,80,150);

	//windows
	fill(240);
	rect(388,120,22,5);
	rect(388,130,34,5);
	rect(388,140,34,5);
	rect(60,160,5,5);
	rect(70,160,5,5);
	rect(80,180,5,5);
	rect(90,180,5,5);
	rect(100,180,5,5);
	rect(110,180,5,5);
	rect(70,190,5,5);
	rect(110,190,5,5);
	rect(100,200,5,5);
	rect(110,200,5,5);
	rect(60,220,5,5);
	rect(70,220,5,5);
	rect(90,220,5,5);
	rect(110,230,5,5);
	rect(60,240,5,5);
	rect(80,240,5,5);
	rect(90,240,5,5);
	rect(100,240,5,5);
	rect(180,282,20,3);
	rect(210,282,20,3);
	rect(240,282,20,3);
	rect(270,282,20,3);
	rect(300,282,20,3);
	rect(490,200,10,20);
	rect(530,210,5,5);
	rect(540,210,5,5);
	rect(550,210,5,5);
	rect(520,220,5,5);
	rect(530,220,5,5);
	rect(510,240,5,5);
	rect(540,240,5,5);
	rect(550,240,5,5);
	rect(490,170,5,5);
	rect(500,170,5,5);
	rect(530,170,5,5);
	rect(550,170,5,5);
	rect(540,160,5,5);
	rect(550,160,5,5);
	rect(500,140,5,5);
	rect(510,140,5,5);
	rect(360,190,5,15);
	rect(370,210,5,15);
	rect(370,230,5,15);
}

The part I struggled with the most was definitely trying to come up with equations for the parabolic pathway of the sun as well as the color equation for the sky. After a lot of trial and error on paper, I was finally able to come up with something and transfer it to the computer and work from there.

kyungak-project-03-dynamic-drawing

sketch

//Kyunga Ko
//15104B
//kyungak@andrew.cmu.edu
//Project-03

var angle = 0;

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

}

function draw() {
    background(mouseX-70,mouseY-30,mouseY);

    //WHen the mouse is on the right side of the canvas

    if (mouseX > 250) {

        var length = max(min(mouseX,640),0);
        var size = length * 600 / 640;
        
        //outer left white eye + black boarder 
        fill(255);
        strokeWeight(10);
        ellipse(100 + length,170,size,size);

        //inner left black iris
        fill(0);
        ellipse(100 + length,170,100,100);

        //inner left grey pupil
        fill(70);
        ellipse(100 + length,170,50,50);

        //outer right white eye + black baorder
        fill(255);
        strokeWeight(10);
        ellipse(500 - length,170,size-100,size-100);

        //inner right black iris
        fill(0);
        ellipse(500 - length,170,size-200,size-200);

        //inner right grey pupil
        fill(70);
        ellipse(500 - length,170,size-250,size-250);

        //mouth
        fill(209,65,65);
        triangle(250,330,340,330,300,380);

    }

    //When the mouse is on the left side of the canvas

    if (mouseX < 250) {

    //green mouth
    strokeWeight(10);
    fill(71,135,100);
    ellipse(mouseX,mouseY,100,random(0,30));

     //green eyes
     fill(71,135,100);
    ellipse(mouseX-50,mouseY-50,30,30);
    ellipse(mouseX+50,mouseY-50,30,30);
    sizeX = 50;
 
    //red mouth
    fill(198,41,88);
    ellipse(mouseX+100,mouseY+200,100,random(0,30));

    //red eyes
    fill(198,41,88);
    ellipse(mouseX+50,mouseY+150,30,30);
    ellipse(mouseX+150,mouseY+150,30,30);
        
    //blue mouth
    fill(42,149,199);
    ellipse(mouseX+200,mouseY,100,random(0,30));

    //blue eyes
    fill(42,149,199);
    ellipse(mouseX+150,mouseY-50,30,30);
    ellipse(mouseX+250,mouseY-50,30,30);

    //line
    push();
    translate(mouseX,mouseY);
    rotate(radians(angle));
    rectMode(CENTER);
    line(mouseX,mouseY,100,100);
    fill(30,60,100);
    rect(mouseX+50, mouseY+50, 50, 50);
    fill(100,240,245);
    rect(mouseX+70, mouseY+150, 70, 70);
    text("BABABA", mouseX+30, mouseY+30);
    pop();
    angle = angle + 0.5;

    }

}


For this project, I wanted to divide the drawing into two parts: left and right. I tried to integrate two different parts into a single painting and continue with the “face” theme that we have been practicing in our previous works. While working on this project, I was able to learn from my mistakes and overcome problems. Although stressful, I believe I can now understand the language better.

 

(The picture is straight up on my desktop, but it turns around like this as soon as I attach it…)

juyeonk – project03 – dynamicdrawing

sketch

// Brandon Hyun
// 15-104 Section B
// bhyun1@andrew.cmu.edu
// Project 04

var increase = 15;
var xInt = 15;

var x1 = 0;
var y1 = 550;
var x2 = 550;
var y2 = 0;
var red;
var green;
var blue;

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

function draw() {
  background (red,green,blue);
  var m = 400/25;
	for(var i = 0; i < m; i += 1) {
        strokeWeight(1);
		    stroke(40,40,40);


        for(var j =0; j<10; j+=1){
          line(mouseX+40*j, increase * i, increase * i +40*j, y1);
        }

		    for(var z =0; z<10; z+=1){
          line(mouseY+ x2 - increase * i, y2+40*z, x1, increase * i+ 40*z);
        }

	}
}

function mousePressed() {
  red = random(0,255);
  green = random (0,255);
  blue = random (0,255);
}

The most difficult part of this project was to code each strand of rain. It was more tedious than hard, but assigning random lengths and speed to each strand was definitely not easy.

You can move around the mouse to change the location of the umbrella.

I wish I could make the code take the mouseY into account as well so that the person wouldn’t smiling if the umbrella was below him/her.

jamieh-Project-03-Dynamic-Drawing

sketch

/*
Jamie Ho
10:30
jamieh@andrew.cmu.edu
Project 03
*/

var rectSize = 10;
var d = 75; //distance from edges and distance between each rectangle's corner

function setup() {
    createCanvas(640, 480);
    rectMode(CORNER);
    angleMode(DEGREES);
}

function draw() {
    background(0);
    fill(256);
    
    //to create array of rectangles
    for(var x = 0+d; x <= width-d; x+=d){
        for(var y = 0+d; y <= height-d; y+=d){
            
            //dis = distance between mouse pointer and rectangle
            var dis = dist(x, y, mouseX, mouseY);
            var inCanvas = d < mouseX & mouseX < width-d && d < mouseY && mouseY < height-d;
                
                
        //CHANGING COLOURS
            //if rectangles are far from mouse: rectangles are white
            //far = more than half the width of canvas
            if(dis > width/2 & inCanvas){            
                fill(256, 256, 256);
            }

                //if rectangles are close from mouse: rectangles flash in colour
                //close = less than half the width of canvas
                else if(dis < width/2 & inCanvas){
                    fill(random(0, 256),random(0, 256),random(0, 256));
                }


        //ROTATING + TRANSLATION
            
            //Top L = "starting point" 
                //no rotation no translation no shear, just size change
            
            //Top R = rotates a bit
            if(mouseX > width/2 & mouseY < height/2 && inCanvas){
                rotate(random(-0.05, 0.05));
            }

            //Bottom R = rotates double of Top R + translates
            if(mouseX > width/2 & mouseY > height/2 && inCanvas){
                rotate(random(-0.1, 0.1));
                translate(x*random(0.005, 0.0075), y*random(0.005, 0.0075));
            }

            //Bottom L = rotates quadruple of Top R/double of Bottom R + translates + shears
            if(mouseX < width/2 & mouseY > height/2 && inCanvas){
                rotate(random(-0.2, 0.2));
                translate(x*random(0.005, 0.0075), y*random(0.005, 0.0075));
                shearX(PI/16);
            }




        //CHANGING SIZE
            //if mouse is within borders of "new" canvas, 
            //then rectangles change size based on distance of pointer to rectangle
            if(inCanvas){
                rect (x, y, dis*0.1, dis*0.1);
            }

                //if mouse is not within canvas, then rectangles are small AND rotates
                else{
                    rect (x, y, rectSize, rectSize)

                }

        }
    }
   
}


For this project, I made use of for loops to create an array of the same shapes, then used conditional statements to make modifications. The dynamic drawing starts off static with the original rectangles, but when the mouse moves, the rectangles change in size based on each of their distances from the mouse. When the mouse moves into a different quadrant, the rectangles react differently through rotation, translation, shear. From the top left quadrant to the bottom left quadrant (clockwise), the movements to the rectangles become more dramatic. The hardest parts of this project were making the for loop work, making sure the conditional statements made sense and adjusting the numbers assigned to variables to an appropriate range so that the shapes appear on canvas.

alchan-Project 03-dynamic drawing

alchan project 03

//Scarlet Tong
//sntong@andrew.cmu.edu
//Section A
// Project 5: Wallpaper

//x and y coordinates the tip of the tear drops
var x = 0;
var y = 0;
// scale
var Large = 25;
var Medium = Large-1;
var Small = Large-5;
// for loop coordinates
var transY = 0;
var transX = 30;

function setup() {
    createCanvas(480, 480);
    background (243,117,117);//hot pink!
}

function draw() {
  //array the pattern on the odd rows
  for (var transY = 0; transY < width; transY+= Large*6+15) {
    for (var transX = 0; transX < width+30; transX+= Large*2+10) {
      pattern(transX,transY);
    }
  }
  // array the pattern for even rows and offset them so they fill the gap
  for (var transY = -Large*3-8; transY < width; transY+= Large*6+15) {
    for (var transX = Large+5; transX < width; transX+= Large*2+10) {
      pattern(transX,transY);
    }
  }
}

function pattern(transX,transY){
  stroke(255);
  strokeWeight(1);
  //deep blue tear drop, aka large drop
  push();
  translate(transX,transY);
  fill(48,78,109);
  beginShape();
  curveVertex(x,y);
  curveVertex(x,y);
  curveVertex(Large,Large*3);
  curveVertex(x,Large*4);
  curveVertex(x-Large, y+Large*3);
  curveVertex(x,y);
  curveVertex(x,y);
  endShape();
  pop();
  //pale orange tear drop, medium drop
  push();
  translate(transX,transY+Large*6);
  fill(237,168,131);
  angleMode(DEGREES);
  rotate(180);
  beginShape();
  curveVertex(x,y);
  curveVertex(x,y);
  curveVertex(Medium,Medium*3);
  curveVertex(x,Medium*4);
  curveVertex(x-Medium, y+Medium*3);
  curveVertex(x,y);
  curveVertex(x,y);
  endShape();
  // teal tear drop, small drop
  fill(43,188,177);
  beginShape();
  curveVertex(x,y+10);
  curveVertex(x,y+10);
  curveVertex(Small,Small*3+10);
  curveVertex(x,Small*4+10);
  curveVertex(x-Small, y+Small*3+10);
  curveVertex(x,y+10);
  curveVertex(x,y+10);
  endShape();
  //yellow circle
  fill(253,185,74);
  ellipse(x,Small*5,Large,Large);
  //small dark blue circle on the tip of the shape
  fill(48,78,109);
  ellipse(0,0,10,10);
  pop();
}

I wanted to play around with rotation for this project and was inspired by stylized/ simplified representations of the solar system (or atoms). I did a few quick sketches of how I wanted the drawing to change as the mouse moved, and from there figured out how I was going to implement the design.

I think the trickiest part of this was figuring out how to change the size of all of the components with the movements of the mouse without making them too large or too small.

 

aranders-project-03

aranders-project-03

//Anna Anderson
//Section D
//aranders@andrew.cmu.edu
//project-03

var pbsize = 30
var pbcolor = 0
var pbposition = 275
var jellysize = 30
var jellycolor = 0
var jellyposition = 25

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

function draw() {
  background(218, 145, 223)
  noStroke();

  //left bread
  fill(255);
  rect(50, 100, 200, 200);
  ellipse(50, 125, 50, 50);
  ellipse(250, 125, 50, 50);

  //right bread
  fill(255);
  rect(350, 100, 200, 200);
  ellipse(350, 125, 50, 50);
  ellipse(550, 125, 50, 50);

  //peanut butter color
  pbcolor = min(max(0, mouseX), 100);
  fill(216, 152, pbcolor);

  //peanut butter position and size
  pbsize = max(min(mouseX, 150));
  pbposition = max(min(mouseY, 375));
  rect(pbposition, 125, pbsize, pbsize);

  //jelly color
  jellycolor = min(max(0, mouseX), 100);
  fill(225, jellycolor, 225);

  //peanut butter position and size
  jellysize = max(min(mouseX, 150));
  jellyposition = max(min(mouseY, 75));
  rect(jellyposition, 125, jellysize, jellysize);

}

I really like peanut butter and jelly and thought this was a good opportunity to digitally spread the goodness. This project went relatively smoothly and was fun to create!

TSWARSTA- Section A- Project-03-Dynamic-Drawing

swarstad-dynamic-drawing


var sizex = 0;

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

function draw() {
	rectMode(CENTER);
    noStroke();
R=(640-mouseX)/2;
G=(480-mouseY)/2;
B=mouseX*(0,255);
//Altering color based on mouse position

background(B,R,G);
//altering background color based on mouse position

sizex=mouseX/2;
if (sizex>160){
	sizex=mouseX/-2;
};
//altering position and size based on x mouse position


sizey=mouseY/2;
if(sizey>120){
	sizey=mouseY/-2;
};
//altering position and size based on y mouse position

rot=PI/(640/mouseX);
//altering rotation based on x position

	fill(R, G, B);
    translate(mouseX, mouseY);
    rotate(rot);
	rect(0, 0, sizex, sizey);
 

}


I was inspired by Jamie XX’s “In Colour” album artwork and visuals. I created a square that is drawn on a background where the color is altered based on mouse location – this is to mimic the spectrum in the album artwork’s background. The shape itself is a square and is altered by the mouse x and y, depending on the quadrant it is in (if you divide the canvas size into 4 parts) as I wanted the location of the shape to respond to the mouse placement as well.

Project 3-Dynamic Art

Dave Dynamic

//Yoonseo(Dave) Choi
//Section B
//yoonseo1@andrew.cmu.edu
//Assignment-03-B
//variable for Bezier curvature 
var Curv;
//variable for Red, Green, Blue color. 
  var R = 0;
  var B = 0;
  var G = 0;
  function setup() {
  createCanvas(640, 480); //setting Canvas size to 600x480
  //No fill for any geometry
  noFill();
  //initializing Curv 
  Curv = 0;
}
function draw() {
  //adding random number to Red for change of color when it is < 255 
  
  //adding random number to Blue for change of color when it is < 255 
 
   //adding random number to Green for change of color when it is < 255  

  //When any of R,G,B elements are over 255, it resets to 0.
  if (R >= 255){
    R = 0;
  }
  if (G >= 255){
    G = 0;
  }
  if (B >= 255){
    B = 0;
  }
  //variable for color c
  var c = color(R,B,G);
  //continuously assign color variable to stroke
  stroke(c, 10);
  //setting up standard place for x and y coordinate. 
  var x = width/2;
  var y = height/2;
  //Dividing the canvas into four difference quadrant. 
  if (mouseX > x & mouseY < y ) { //when mouse is on right top quadrant
    Curv += mouseX/60; //Curv value goes up randomly from 1 to 5
    R += mouseX/120 + mouseY/50;// Red is sum of differenct X and Y value
   }
   if (mouseX < x & mouseY < y){//when mouse is on left top quadrant
    Curv -= mouseY/30; //Curv value goes down randomly from 4 to 12
    B += mouseX/40 + mouseY/80;// Blue is sum of differenct X and Y value
   }
   if (mouseY > y & mouseX > x){//when mouse is on right bottom quadrant
    Curv += mouseY/60;//Curv value goes up randomly from 4 to 12
   }
   if (mouseY > y & mouseX < x){//when mouse is on left bottom quadrant
    Curv -= mouseX/30;//Curv valvue goes down randomly from 1 to 5
    G += mouseX/70 + mouseY/100;// Green is sum of differenct X and Y value
   }
   //when Curv is larger than height or width, or less than 0 , it will reset to 0.
  if ( Curv > height || Curv < 0 || Curv > width){ 
    Curv = 0;
   }
   //setting background to black 
  background(0);
  //bezier curves.
  //each for statement is used to generate multiple bezier curve based on increment of i value
  //bezier curve assigns, anchor points and control points to create paramatric curve. 
  //bezier(anchor pts, anchor pts, control pts, control pts, control pts2,control pts2, anchor pts2,anchor pts2)
  for (var i = 0; i < mouseX; i += 30){
    bezier(mouseX-(Curv+i/2.0), mouseY-Curv+i, Curv*2, Curv, Curv*2, Curv*2, mouseX, 0);
  }
  //based on the i and z constraint, number of lines are decided. 
  // i or z's constraints are defined by mouse X adn Y position
  // all the position of the anchor points are based on the mouse X and Y 
  for (var z = 200; z < mouseY; z += 30){
    bezier(mouseX-(Curv+z/2.0), mouseY-Curv+z, Curv*4, Curv/6, Curv*3, Curv*2, width-mouseX, 0);
  }
 for (var i = 0; i < height-mouseY; i += 30){
    bezier(mouseX+(Curv+i/2.0), mouseY+Curv+i, Curv*2, Curv, Curv*2, Curv*2, 0, mouseY);
  }
  for (var z = 200; z < width-mouseX; z += 30){
    bezier(mouseX+(Curv+z/2.0), mouseY-Curv+z, Curv*4, Curv/6, Curv*3, Curv*2, width, height-mouseY);
  }
  

}

For this Dynamic art project, I focused on the movement of line in a curve form. At first, I wanted to express very light wing like motion based on the mouse position. I abstracted the initial concept and created the following digital illustration of movement. Fortunately, I found a example at p5js website that resembles part of what I imagined. I took that example and modified to create my own dynamic art.

Jihee_SectionD_Project-03-Dynamic-Drawing

jiheek1_project3

//Jihee Kim
//15-104 MWF 9:30
//jiheek1@andrew.cmu.edu
//project3 dynamic drawing
//section D


var backgroundRed = 124;
var backgroundGreen = 124;
var backgroundBlue = 124;
var angle = 0;
var move = 0;
var wbSize = 100;


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


function draw() {
    //the background gets lighter in grayscale from left to right
    background(backgroundRed, backgroundGreen, backgroundBlue);
    backgroundRed = map(mouseX, 0, width, 0, 124);
    backgroundGreen = map(mouseX, 0, width, 0, 124);
    backgroundBlue = map(mouseX, 0, width, 0, 124);

    if (mouseX > width) {
        backgroundRed = 0;
        backgroundGreen = 0;
        backgroundBlue = 0;
    }

    if (mouseX < 0) {
        backgroundRed = 124;
        backgroundGreen = 124;
        backgroundBlue = 124;
    }

    //draw debris from destyoed buildlings floating, rotating in the air
    fill(255);
    noStroke();
    push();
    translate(100, 100);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 2, 2); //particle rotates
    pop();
    angle = angle + 2;
    move = move + 0.04;

    push();
    translate(280, 190);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 3, 3);
    pop();

    push();
    translate(25, 60);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 2, 2);
    pop();

    push();
    translate(500, 20);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 2, 2);
    pop();

    push();
    translate(320, 20);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 2, 2);
    pop();

    push();
    translate(50, 20);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 2, 2);
    pop();

    push();
    translate(555, 175);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 3, 3);
    pop();

    push();
    translate(545, 172);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 1, 1);
    pop();

    push();
    translate(530, 172);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 1, 1);
    pop();

    push();
    translate(190, 140);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 2, 2);
    pop();

    push();
    translate(185, 110);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 4, 4);
    pop();

    push();
    translate(20, 400);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 5, 5);
    pop();

    push();
    translate(400, 320);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 5, 5);
    pop();

    push();
    translate(375, 335);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 5, 5);
    pop();

    //add some randomness to the particles
    //position of the mouse will determine some particles' speed
    push();
    if (mouseY >= 240) {
        rotate(millis()/100); //bottom half of canvas = fast spinning speed
    }

    if (mouseY <= 240) {
        rotate(millis()/500); //top half of canvas = slow spinning speed
    }
    translate(50, 100);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 2, 2);
    pop();

    push();
    if (mouseY >= 240) {
        rotate(millis()/100); //bottom half of canvas = fast spinning speed
    }

    if (mouseY <= 240) {
        rotate(millis()/500); //top half of canvas = slow spinning speed
    }
    translate(50, 20);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 2, 2);
    pop();

    push();
    if (mouseY >= 240) {
        rotate(millis()/100); //bottom half of canvas = fast spinning speed
    }

    if (mouseY <= 240) {
        rotate(millis()/500); //top half of canvas = slow spinning speed
    }
    translate(310, 55);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 2, 2);
    pop();

    push();
    if (mouseY >= 240) {
        rotate(millis()/100); //bottom half of canvas = fast spinning speed
    }

    if (mouseY <= 240) {
        rotate(millis()/500); //top half of canvas = slow spinning speed
    }
    translate(310, 200);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 5, 5);
    pop();

    push();
    if (mouseY >= 240) {
        rotate(millis()/100); //bottom half of canvas = fast spinning speed
    }

    if (mouseY <= 240) {
        rotate(millis()/500); //top half of canvas = slow spinning speed
    }
    translate(550, 170);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 3, 3);
    pop();

    push();
    if (mouseY >= 240) {
        rotate(millis()/100); //bottom half of canvas = fast spinning speed
    }

    if (mouseY <= 240) {
        rotate(millis()/500); //top half of canvas = slow spinning speed
    }
    translate(510, 140);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 1, 1);
    pop();

    push();
    if (mouseY >= 240) {
        rotate(millis()/100); //bottom half of canvas = fast spinning speed
    }

    if (mouseY <= 240) {
        rotate(millis()/500); //top half of canvas = slow spinning speed
    }
    translate(165, 135);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 2, 2);
    pop();

    push();
    if (mouseY >= 240) {
        rotate(millis()/100); //bottom half of canvas = fast spinning speed
    }

    if (mouseY <= 240) {
        rotate(millis()/500); //top half of canvas = slow spinning speed
    }
    translate(150, 300);
    rotate(radians(angle));
    translate(move, 0);
    ellipse(0, 0, 5, 5);
    pop();

    //a wrecking ball swings across the canvas and breaks buildings
    //draw the chain (an array of same sized ellipses or 'beads')
    //the swinging range beads increases from top to bottom
    fill(0);
    var bx1 = map(mouseX, 0, width, 100, 420); //limit of swing in x direction
    var by1 = map(mouseY, 0, height, 0, 20);
    ellipse(bx1, by1, 20, 20); //draw the first (top) bead of the chain
    var bx2 = map(mouseX, 0, width, 98, 424);
    var by2 = map(mouseY, 0, height, 20, 40);
    ellipse(bx2, by2, 20, 20); //draw second bead of the chain
    var bx3 = map(mouseX, 0, width, 95, 428);
    var by3 = map(mouseY, 0, height, 40, 60);
    ellipse(bx3, by3, 20, 20); //draw third bead of the chain
    var bx4 = map(mouseX, 0, width, 92, 432);
    var by4 = map(mouseY, 0, height, 60, 80);
    ellipse(bx4, by4, 20, 20); //draw fouth bead of the chain
    var bx5 = map(mouseX, 0, width, 88, 440);
    var by5 = map(mouseY, 0, height, 80, 100);
    ellipse(bx5, by5, 20, 20); //draw fifth bead of the chain
    var bx6 = map(mouseX, 0, width, 84, 452);
    var by6 = map(mouseY, 0, height, 100, 120);
    ellipse(bx6, by6, 20, 20); //draw sixth bead of the chain
    var bx7 = map(mouseX, 0, width, 79, 468);
    var by7 = map(mouseY, 0, height, 120, 140);
    ellipse(bx7, by7, 20, 20); //draw seventh bead of the chain
    var bx8 = map(mouseX, 0, width, 74, 480);
    var by8 = map(mouseY, 0, height, 140, 160);
    ellipse(bx8, by8, 20, 20); //draw eighth bead of the chain
    var bx9 = map(mouseX, 0, width, 68, 502);
    var by9 = map(mouseY, 0, height, 160, 180);
    ellipse(bx9, by9, 20, 20); //draw ninth bead of the chain
    var bx10 = map(mouseX, 0, width, 62, 528);
    var by10 = map(mouseY, 0, height, 180, 200);
    ellipse(bx10, by10, 20, 20); //draw tenth bead of the chain
    var bx11 = map(mouseX, 0, width, 56, 555);
    var by11 = map(mouseY, 0, height, 200, 220);
    ellipse(bx11, by11, 20, 20); //draw eleventh bead of the chain

    //draw the wrecking ball
    var wbx = map(mouseX, 0, width, 50, 595);
    var wby = map(mouseY, 0, height, 220, 265);
    ellipse(wbx, wby, wbSize, wbSize);

    //the wrecking ball gets bigger as it approaches both extremes of width
    if(mouseX < width/2) {
        wbSize = ((-mouseX+30) & (mouseY)); //gets bigger by left edge
    }
    if(mouseX > width/2) {
        wbSize = ((mouseX*0.5+50) & (mouseY)); //gets bigger by right edge
    }

    //draw the buildings
    //make so that buildings shrink when touched by wrecking ball
    //building 1
    if(mouseX > 0 & mouseX < 45) {
        fill(255);
        noStroke();
        rect(0, height-165, 45, 165); //building before being touched by ball
    }
    else{
        fill(255);
        noStroke();
        rect(0, height-180, 45, 180); //building gets shorter by 15
    }
    //draw windows
    fill(0);
    rect(5, height-175, 5, 10); //row1
    rect(15, height-175, 5, 10);
    rect(25, height-175, 5, 10);
    rect(35, height-175, 5, 10);

    rect(5, height-155, 5, 10); //row2
    rect(15, height-155, 5, 10);
    rect(25, height-155, 5, 10);
    rect(35, height-155, 5, 10);

    rect(5, height-135, 5, 10); //row3
    rect(15, height-135, 5, 10);
    rect(25, height-135, 5, 10);
    rect(35, height-135, 5, 10);

    rect(5, height-115, 5, 10); //row4
    rect(15, height-115, 5, 10);
    rect(25, height-115, 5, 10);
    rect(35, height-115, 5, 10);

    rect(5, height-95, 5, 10); //row5
    rect(15, height-95, 5, 10);
    rect(25, height-95, 5, 10);
    rect(35, height-95, 5, 10);

    rect(5, height-75, 5, 10); //row6
    rect(15, height-75, 5, 10);
    rect(25, height-75, 5, 10);
    rect(35, height-75, 5, 10);

    rect(5, height-55, 5, 10); //row7
    rect(15, height-55, 5, 10);
    rect(25, height-55, 5, 10);
    rect(35, height-55, 5, 10);

    //draw building 2
    if(mouseX > 55 & mouseX < 100) {
        fill(255);
        noStroke();
        rect(55, height-145, 45, 145);
    }
    else{
        fill(255);
        noStroke();
        rect(55, height-160, 45, 160); //building gets shorter by 15
    }
    //draw windows
    fill(0);
    rect(60, height-155, 5, 10); //row1
    rect(70, height-155, 5, 10);
    rect(80, height-155, 5, 10);
    rect(90, height-155, 5, 10);

    rect(60, height-135, 5, 10); //row2
    rect(70, height-135, 5, 10);
    rect(80, height-135, 5, 10);
    rect(90, height-135, 5, 10);

    rect(60, height-115, 5, 10); //row3
    rect(70, height-115, 5, 10);
    rect(80, height-115, 5, 10);
    rect(90, height-115, 5, 10);

    rect(60, height-95, 5, 10); //row4
    rect(70, height-95, 5, 10);
    rect(80, height-95, 5, 10);
    rect(90, height-95, 5, 10);

    rect(60, height-75, 5, 10); //row5
    rect(70, height-75, 5, 10);
    rect(80, height-75, 5, 10);
    rect(90, height-75, 5, 10);

    rect(60, height-45, 5, 10); //row6
    rect(70, height-45, 5, 10);
    rect(80, height-45, 5, 10);
    rect(90, height-45, 5, 10);

    rect(60, height-25, 5, 10); //row7
    rect(70, height-25, 5, 10);
    rect(80, height-25, 5, 10);
    rect(90, height-25, 5, 10);

    //draw building 3
    if(mouseX > 110 & mouseX < 160) {
        fill(255);
        noStroke();
        rect(110, height-95, 50, 95);
    }
    else{
        fill(255);
        noStroke();
        rect(110, height-130, 50, 130); //building gets shorter by 35
    }
    //draw windows
    fill(0);
    rect(115, height-125, 10, 10); //row1
    rect(130, height-125, 10, 10);
    rect(145, height-125, 10, 10);

    rect(115, height-110, 10, 10); //row2
    rect(130, height-110, 10, 10);
    rect(145, height-110, 10, 10);

    rect(115, height-90, 10, 10); //row3
    rect(130, height-90, 10, 10);
    rect(145, height-90, 10, 10);

    rect(115, height-75, 10, 10); //row4
    rect(130, height-75, 10, 10);
    rect(145, height-75, 10, 10);

    rect(115, height-55, 10, 10); //row5
    rect(130, height-55, 10, 10);
    rect(145, height-55, 10, 10);

    rect(115, height-40, 10, 10); //row6
    rect(130, height-40, 10, 10);
    rect(145, height-40, 10, 10);

    rect(125, height-10, 20, 10); //row7

    //draw building 4
    if(mouseX > 170 & mouseX < 210) {
        fill(255);
        noStroke();
        rect(170, height-105, 40, 105);
    }
    else{
        fill(255);
        noStroke();
        rect(170, height-120, 40, 120); //building gets shorter by 15
    }
    //draw windows
    fill(0);
    rect(173, height-115, 5, 10); //row1
    rect(183, height-115, 5, 10);
    rect(193, height-115, 5, 10);
    rect(203, height-115, 5, 10);

    rect(173, height-100, 5, 10); //row2
    rect(183, height-100, 5, 10);
    rect(193, height-100, 5, 10);
    rect(203, height-100, 5, 10);

    rect(173, height-85, 5, 10); //row3
    rect(183, height-85, 5, 10);
    rect(193, height-85, 5, 10);
    rect(203, height-85, 5, 10);

    rect(173, height-70, 5, 10); //row4
    rect(183, height-70, 5, 10);
    rect(193, height-70, 5, 10);
    rect(203, height-70, 5, 10);

    rect(173, height-55, 5, 10); //row5
    rect(183, height-55, 5, 10);
    rect(193, height-55, 5, 10);
    rect(203, height-55, 5, 10);

    //draw building 5
    if(mouseX > 225 & mouseX < 280) {
        fill(255);
        noStroke();
        rect(225, height-90, 55, 90);
    }
    else{
        fill(255);
        noStroke();
        rect(225, height-100, 55, 100); //building gets shorter by 10
    }
    //draw windows
    fill(0);
    rect(230, height-95, 5, 5); //row1
    rect(240, height-95, 5, 5);
    rect(250, height-95, 5, 5);
    rect(260, height-95, 5, 5);
    rect(270, height-95, 5, 5);

    rect(230, height-85, 5, 5); //row2
    rect(240, height-85, 5, 5);
    rect(250, height-85, 5, 5);
    rect(260, height-85, 5, 5);
    rect(270, height-85, 5, 5);

    rect(230, height-75, 5, 5); //row3
    rect(240, height-75, 5, 5);
    rect(250, height-75, 5, 5);
    rect(260, height-75, 5, 5);
    rect(270, height-75, 5, 5);

    rect(230, height-65, 5, 5); //row4
    rect(240, height-65, 5, 5);
    rect(250, height-65, 5, 5);
    rect(260, height-65, 5, 5);
    rect(270, height-65, 5, 5);

    rect(230, height-55, 5, 5); //row5
    rect(240, height-55, 5, 5);
    rect(250, height-55, 5, 5);
    rect(260, height-55, 5, 5);
    rect(270, height-55, 5, 5);

    rect(230, height-45, 5, 5); //row6
    rect(240, height-45, 5, 5);
    rect(250, height-45, 5, 5);
    rect(260, height-45, 5, 5);
    rect(270, height-45, 5, 5);

    rect(230, height-35, 5, 5); //row7
    rect(240, height-35, 5, 5);
    rect(250, height-35, 5, 5);
    rect(260, height-35, 5, 5);
    rect(270, height-35, 5, 5);

    rect(230, height-25, 5, 5); //row8
    rect(240, height-25, 5, 5);
    rect(250, height-25, 5, 5);
    rect(260, height-25, 5, 5);
    rect(270, height-25, 5, 5);

    rect(230, height-15, 5, 5); //row9
    rect(240, height-15, 5, 5);
    rect(250, height-15, 5, 5);
    rect(260, height-15, 5, 5);
    rect(270, height-15, 5, 5);

    //draw building 6
    if(mouseX > 290 & mouseX < 355) {
        fill(255);
        noStroke();
        rect(290, height-100, 65, 100);
    }
    else{
        fill(255);
        noStroke();
        rect(290, height-120, 65, 120); //building gets shorter by 20
    }
    //draw windows
    fill(0);
    rect(295, height-95, 15, 10); //row1
    rect(315, height-95, 15, 10);
    rect(335, height-95, 15, 10);

    rect(295, height-80, 15, 10); //row2
    rect(315, height-80, 15, 10);
    rect(335, height-80, 15, 10);

    rect(295, height-65, 15, 10); //row3
    rect(315, height-65, 15, 10);
    rect(335, height-65, 15, 10);

    rect(295, height-45, 15, 10); //row4
    rect(315, height-45, 15, 10);
    rect(335, height-45, 15, 10);

    rect(295, height-30, 15, 10); //row5
    rect(315, height-30, 15, 10);
    rect(335, height-30, 15, 10);

    rect(295, height-15, 15, 10); //row6
    rect(315, height-15, 15, 10);
    rect(335, height-15, 15, 10);

    //draw building 7
    if(mouseX > 370 & mouseX < 415) {
        fill(255);
        noStroke();
        rect(370, height-90, 45, 90);
    }
    else{
        fill(255);
        noStroke();
        rect(370, height-100, 45, 100); //building gets shorter by 10
    }
    //draw windows
    fill(0);
    rect(374, height-95, 7, 5); //row1
    rect(384, height-95, 7, 5);
    rect(394, height-95, 7, 5);
    rect(404, height-95, 7, 5);

    rect(374, height-85, 7, 5); //row2
    rect(384, height-85, 7, 5);
    rect(394, height-85, 7, 5);
    rect(404, height-85, 7, 5);

    rect(374, height-75, 7, 5); //row3
    rect(384, height-75, 7, 5);
    rect(394, height-75, 7, 5);
    rect(404, height-75, 7, 5);

    rect(374, height-65, 7, 5); //row4
    rect(384, height-65, 7, 5);
    rect(394, height-65, 7, 5);
    rect(404, height-65, 7, 5);

    rect(374, height-55, 7, 5); //row5
    rect(384, height-55, 7, 5);
    rect(394, height-55, 7, 5);
    rect(404, height-55, 7, 5);

    rect(374, height-45, 7, 5); //row6
    rect(384, height-45, 7, 5);
    rect(394, height-45, 7, 5);
    rect(404, height-45, 7, 5);

    rect(374, height-35, 7, 5); //row7
    rect(384, height-35, 7, 5);
    rect(394, height-35, 7, 5);
    rect(404, height-35, 7, 5);

    rect(374, height-25, 7, 5); //row8
    rect(384, height-25, 7, 5);
    rect(394, height-25, 7, 5);
    rect(404, height-25, 7, 5);

    rect(374, height-15, 7, 5); //row9
    rect(384, height-15, 7, 5);
    rect(394, height-15, 7, 5);
    rect(404, height-15, 7, 5);

    //draw building 8
    if(mouseX > 425 & mouseX < 466) {
        fill(255);
        noStroke();
        rect(425, height-95, 41, 95);
    }
    else{
        fill(255);
        noStroke();
        rect(425, height-110, 41, 110); //building gets shorter by 15
    }
    //draw windows
    fill(0);
    rect(428, height-105, 5, 10); //row1
    rect(438, height-105, 5, 10);
    rect(448, height-105, 5, 10);
    rect(458, height-105, 5, 10);

    rect(428, height-88, 5, 10); //row2
    rect(438, height-88, 5, 10);
    rect(448, height-88, 5, 10);
    rect(458, height-88, 5, 10);

    rect(428, height-71, 5, 10); //row3
    rect(438, height-71, 5, 10);
    rect(448, height-71, 5, 10);
    rect(458, height-71, 5, 10);

    rect(428, height-54, 5, 10); //row4
    rect(438, height-54, 5, 10);
    rect(448, height-54, 5, 10);
    rect(458, height-54, 5, 10);

    //draw building 9
    if(mouseX > 479 & mouseX < 530) {
        fill(255);
        noStroke();
        rect(479, height-105, 51, 105);
    }
    else{
        fill(255);
        noStroke();
        rect(479, height-140, 51, 140); //building gets shorter by 35
    }
    //draw windows
    fill(0);
    rect(482, height-135, 5, 10); //row1
    rect(492, height-135, 5, 10);
    rect(502, height-135, 5, 10);
    rect(512, height-135, 5, 10);
    rect(522, height-135, 5, 10);

    rect(482, height-115, 5, 10); //row2
    rect(492, height-115, 5, 10);
    rect(502, height-115, 5, 10);
    rect(512, height-115, 5, 10);
    rect(522, height-115, 5, 10);

    rect(482, height-95, 5, 10); //row3
    rect(492, height-95, 5, 10);
    rect(502, height-95, 5, 10);
    rect(512, height-95, 5, 10);
    rect(522, height-95, 5, 10);

    rect(482, height-75, 5, 10); //row4
    rect(492, height-75, 5, 10);
    rect(502, height-75, 5, 10);
    rect(512, height-75, 5, 10);
    rect(522, height-75, 5, 10);

    rect(482, height-55, 5, 10); //row5
    rect(492, height-55, 5, 10);
    rect(502, height-55, 5, 10);
    rect(512, height-55, 5, 10);
    rect(522, height-55, 5, 10);

    rect(482, height-35, 5, 10); //row6
    rect(492, height-35, 5, 10);
    rect(502, height-35, 5, 10);
    rect(512, height-35, 5, 10);
    rect(522, height-35, 5, 10);

    rect(495, height-10, 20, 10); //row7

    //draw building 10
    if(mouseX > 540 & mouseX < 585) {
        fill(255);
        noStroke();
        rect(540, height-120, 45, 120);
    }
    else{
        fill(255);
        noStroke();
        rect(540, height-150, 45, 150); //building gets shorter by 30
    }
    //draw windows
    fill(0);
    rect(545, height-145, 20, 10); //row1
    rect(570, height-145, 10, 10);

    rect(540, height-130, 15, 10); //row2
    rect(560, height-130, 10, 10);
    rect(575, height-130, 10, 10);

    rect(540, height-115, 5, 10); //row3
    rect(550, height-115, 10, 10);
    rect(565, height-115, 20, 10);

    rect(540, height-100, 10, 10); //row4
    rect(555, height-100, 20, 10);
    rect(580, height-100, 5, 10);

    rect(540, height-85, 5, 10); //row5
    rect(550, height-85, 10, 10);
    rect(565, height-85, 20, 10);

    rect(540, height-70, 15, 10); //row6
    rect(560, height-70, 10, 10);
    rect(575, height-70, 10, 10);

    rect(545, height-55, 20, 10); //row7
    rect(570, height-55, 10, 10);

    rect(540, height-40, 15, 10); //row8
    rect(560, height-40, 10, 10);
    rect(575, height-40, 10, 10);

    rect(540, height-25, 5, 10); //row9
    rect(550, height-25, 10, 10);
    rect(565, height-25, 20, 10);

    rect(540, height-10, 10, 10); //row10
    rect(555, height-10, 20, 10);
    rect(580, height-10, 5, 10);

    //draw building 11
    if(mouseX > 595 & mouseX < 640) {
        fill(255);
        noStroke();
        rect(595, height-110, 45, 110);
    }
    else{
        fill(255);
        noStroke();
        rect(595, height-135, 45, 135); //building gets shorter by 25
    }
    //draw windows
    fill(0);
    rect(602, height-125, 10, 10); //row 1
    rect(622, height-125, 10, 10);

    rect(602, height-105, 10, 10); //row2
    rect(622, height-105, 10, 10);

    rect(602, height-85, 10, 10); //row3
    rect(622, height-85, 10, 10);

    rect(602, height-65, 10, 10); //row4
    rect(622, height-65, 10, 10);

    rect(602, height-45, 10, 10); //row5
    rect(622, height-45, 10, 10);
}

sketch

For my project, I made a dynamic drawing that is controlled by the mouse, or the user. I varied several elements, including size, color, rotation and position.

The user can move the wrecking ball to wherever in the canvas and manipulate the size of the buildings. One can see that the size of the ball itself changes, according to position as well. The size of the wrecking ball is largest when the mouse is located on both extremes of the width. The height of the buildings decreases when approached by the ball.

As for colors, as you move the mouse from left to right, the background changes from dark to light.

Another element that the mouse controls is the particles floating in air. It could be considered stars or dust. When the mouse is in the bottom half of the canvas, the particles rotate at a faster pace than they do when the mouse is in the top half of the canvas.

I would say that some challenges came from how tedious my design was. I also wish that I could have made the windows on the buildings to change color in the same fashion that the background does to keep it more consistent.

jennyzha-project-03

sketch

var angle = 0;
var m = 0;
var n = 0;
var size = 0;
var sizen = 0;
var x = 0;
var z = 0;

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

function draw() {
	x = max(min(mouseX, 255), 0);
	z =max(min(mouseX, 255), 0);
	background(0);
	fill(x, 255, z);
	ellipseMode(CENTER);

//create ellipse with color dependent on where the mouse is

	m = max(min(mouseX, 640), 0);
	n = max(min(mouseY, 480), 0);
// //setting the x and y coordinates to be the max value between the mouse coordinates and the canvas size 

	size = m * 350 / 400;
	sizen = n * 350 / 400;
	//settin the size of the ellipse to be a function of the position of the coordinates


	push();
	ellipse(mouseX, mouseY, size, sizen);
	//using the variables to create an ellipse
	fill(x, 255, z);
	//filling the color for the ellipse based on where the mouse is on the canvas
	translate(mouseX,mouseY);
	//moving the ellipse based on where the ellipse is in the canvas
	rotate(radians(angle));
	//rotating the ellips
	pop();
	angle = angle +5;
}