agusman-Project03-DynamicDrawing

sketch

// Anna Gusman
// Section A
// Project 03
// This code is a bouncy-bodied, color-changing brush concept.
// Referencing properties of spring and damping forces from p5, I create a brush shape
// that organically changes dimensions as the mouse is dragged. 

var centerX = 0.0, centerY = 0.0; // center point of the polygon

var radius = 45, rotAngle = -30;
var accelX = 0.0, accelY = 0.0;
var deltaX = 0.0, deltaY = 0.0;
var springing = 0.0009, damping = 0.98;
//values of the spring and damp forces that make the triangle speed up and slow down when following the mouse.
//
var rr = 10;
var gg= 10;
var bb= 10;
var colorchange = 90;

//dictate the number of nodes
var nodes = 3;

//create zero fill arrays
var nodeStartX = [];
var nodeStartY = [];
var nodeX = [];
var nodeY = [];
var angle = [];
var frequency = [];

// soft-body dynamics
var organicConstant = 1.0;

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

  //center shape in window
  centerX = width/2;
  centerY = height/2;

  //initialize arrays to 0
  for (var i=0; i<nodes; i++){
    nodeStartX[i] = 0;
    nodeStartY[i] = 0;
    nodeY[i] = 0;
    nodeY[i] = 0;
    angle[i] = 0;
  }

  // iniitalize frequencies for corner nodes
  for (var i=0; i<nodes; i++){
    frequency[i] = random(5, 12);
  }

  frameRate(60); //increase the drawing speed
}

function draw() {
  //fade the background
  // fill(255, 10);
  // background(200, 3);
  fill(rr, gg, bb); //color of polygon
    rr = 127.5*cos(2*PI*colorchange/360) + 127.5;
    gg = 127.5*sin(2*PI*colorchange/360) + 127.5;
    bb = 127.5*sin(2*PI*(colorchange-20)/360) + 127.5;

colorchange++;
  stroke(0);
  drawShape();
  moveShape();
}

function drawShape() {
  //  calculate the locations of the nodes
  for (var i=0; i<nodes; i++){
    nodeStartX[i] = centerX+cos(radians(rotAngle))*radius;
    nodeStartY[i] = centerY+sin(radians(rotAngle))*radius;
    rotAngle += 360.0/nodes; //drawing 3 points on the circumference of the circle
  }

  // draw polygon
  curveTightness(organicConstant);
  beginShape();
  for (var i=0; i<nodes; i++){
    curveVertex(nodeX[i], nodeY[i]);
  }
  for (var i=0; i<nodes-1; i++){
    curveVertex(nodeX[i], nodeY[i]);
  }
  endShape(CLOSE);
}

function moveShape() {
  //move the center point
  deltaX = mouseX-centerX;
  deltaY = mouseY-centerY;

  // create springing effect
  deltaX *= springing;
  deltaY *= springing;
  accelX += deltaX;
  accelY += deltaY;

  // move the polygon's center
  centerX += accelX;
  centerY += accelY;

  // slow down springing so that the polygon does not continue moving infinitely
  accelX *= damping;
  accelY *= damping;

  // change the tightness of the curves using the organic constant
  organicConstant = 1-((abs(accelX)+abs(accelY))*0.1);

  //move the nodes
  for (var i=0; i<nodes; i++){
    nodeX[i] = nodeStartX[i]+sin(radians(angle[i]))*(accelX*2);
    nodeY[i] = nodeStartY[i]+sin(radians(angle[i]))*(accelY*2);
    angle[i] += frequency[i];
  }
}

For this project, I created an bouncy-bodied, color-changing brush concept. I referenced p5’s softbody dynamics example in order to see how they treated oscillating vector forces. You can find the example here

I was inspired to create a brush concept from the bit of code I wrote in this week’s recitation lab on creating a mouse controlled spiraling ellipse. I first made iterations on this to explore styling options and effects.

Example:

Example:

Still, the brush felt more controlled and predictable than I wanted to to be- I wanted there to be a larger element of surprise. Elements of the soft body dynamics example allowed me to soften the reactions of my shape/brush by giving it springing and damping properties, created by controlling the relationships between the drawn vertexes(nodes) of the shape (curveTightness and curveVertex. This makes the brush wiggle and have a pleasing, natural element to it’s movement. I then control the number of vertexes and sides of the shape and the acceleration and movement of these vertexes. (accel, delta, springing, damping, nodeStart, node).

Next I wanted to illustrate change across the movement of the brush path. I did this by creating a color system that undulates across the length of 3 sine waves, one each for red, blue and green.

I also experimented further with eliminating or altering the spring relationship between the mouse and the center of the polygon. Here is one example:

In future iterations of this brush concept, I’d like to embed customization of the brush shape so that when you click, you could alter the number of vertexes that would result in different brush trails. Definitely excited to play around with this more, as it has been a great learning experience.

haewanp – Project 03 – Dynamic Drawing

Dynamic Drawing

//Hae Wan Park
//15104-A
//haewanp@andrew.cmu.edu
//Project-03-DynamicDrawing

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

}

function draw() {
    
    var Top = 480;
    var bottom = Top + 180;
    var x = 110;
    var y = 50;
    var c1 = color(0);
    var c2 = color(0);

    var mX = max(min(mouseX, 480), 0);
    var mY = max(min(mouseY, 640), 0);
    
    var mX_L = max(min(mouseX, 240), 0); // when mouse is on left side
    var mX_R = max(min(mouseX, 480), 240); // when mouse is on right side
    
    
    if (mY > height/2) {
        c1 = color(255); //change color from black to white
        strokeWeight(20);
    }
    
    background(c1);
    
    //Blue Stripe Pattern when mouse hovers below than half of height
    for (var r = 0; r < 40; r += 1) {
        
        if (r % 2 == 0) {
            
            if (mY > height/2) {
                c2 = color(0, 41, 149); //change color from black to blue
            } 
            stroke(c2);     
        } 
        line(-50, height/10 * r - 560 + mY, width + 50, height/10 * r - 260 - mY);
    } 
    
    //outline of cube 
    strokeJoin(ROUND);
    strokeWeight(5);
    stroke(255);
    
    //outline of cube disappears when mouse hovers below than half of height
    if (mY > height/2) {
        strokeWeight(0);
    }
    
    
    for (i = -4; i < 4; i+=1) {
        
    fill(237, 10, 124); // Magenta, Top Side of Cube
    quad(mX, Top + 2*y + (mX_R - mX_L)/10, 
    mX_L - x, Top + y, 
    width/2, Top - (mX_R - mX_L)/10, 
    mX_R + x, Top + y);

    fill(14, 198, 184);  // Green, Left Side of Cube
    quad(mX, Top + 2*y + (mX_R - mX_L)/10, 
    mX_L - x, Top + y, 
    mX_L - x, bottom, 
    mX, bottom + y + (mX_R - mX_L)/10);

    fill(255, 241, 0); // yellow, Right Side of Cube
    quad(mX, Top + 2*y + (mX_R - mX_L)/10, 
    mX_R + x, Top + y, 
    mX_R + x, bottom, 
    mX, bottom + y + (mX_R - mX_L)/10);
        
    Top = Top - 210 + mY/5.5;
    bottom = bottom - 210 + mY/5.5;
    }

}


It was a process to consider the relationship among graphic elements and explore the way execute in coding. The more I learn about p5.js the more challenging project comes. But, actually, that means also I can create more complex and dynamic graphics in p5.js.

mjnewman Project-03 Dynamic Drawings, Section A

mjnewman-dynamic-drawing

//Meredith Newman
//Section A
//mjnewman@andrew.cmu.edu
//Project-02-Dynamic-Drawing

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

function draw() {
	//clean slate
	background(255);

	//sliding blue rectangle used for background when mouse is full width
	fill(32, 24, 135);
	noStroke();
	rect(0, 0, mouseX, 480);

	//white lines behind diagonal red lines
	stroke(255);
	strokeWeight(90);
	if (mouseX <= width) {
		line(0, 0, mouseX, 480);
		line(0, 480, mouseX, 0);
	}

	//red diagonal lines
	stroke(230, 24, 30);
	strokeWeight(30);
	if (mouseX <= width) {
		line(0, 30, mouseX, 450);
		line(30, 480, mouseX - 30, 0);
	}

	noStroke();
	//white stripes on cross
	fill(255);
	rect(0, 150, mouseX, 180);
	rect(270, 0, 100, mouseY);

	//red stripes on cross
	fill(230, 24, 30);
	rect(0, 190, mouseX, 100);
	rect(290, 0, 60, mouseY);

	//changing of color to colour
	if (mouseX < width* 0.75){
		textSize(70);
		fill(13, 202, 89);
		textStyle(BOLD);
		text("Color", 230, 265);
	} else if (mouseX > width * 0.75){
		textSize(70);
		fill(32, 24, 135);
		textStyle(BOLD);
		text("Colour", 230, 265);
	}
}

I wanted to approach my project not just with the idea of of dynamic drawings, but also of dynamic words. I also wanted to add a little humor (or humour) to the project, the changing of color from green is a slight nod to the “right way” of spelling the word. If I had more time, I would have found a way to incorporate more words that are translated differently from culture to culture, but in the same language.

hdw – Project 3 – Dynamic Drawing

Press any key to interact.

sketch

var x = 180
var r = 30;
var ellipseX;//ellipse's x position
var ellipseY;
var z = 0 //distance from center + opacity
var canBig = 1;

function setup() {
    background(255, 255, 255);
    createCanvas(640, 480);
    ellipseY = .5*height;
    ellipseX = .5*width;

}

function keyPressed() {
  if(canBig == 1){
    r=r+5;
    x=x-5;
    z=z+1;
  }
  if(r>320 & canBig == 1){
    canBig = 0;
    print(boundary);
  }
  if(canBig == 0){
    r=r-5;
    x=x+5;
    z=z-1;
  }
  if(r < 5 & canBig == 0){
    canBig = 1;
  }
}

function draw() {

    background(255, 255, 255, 200);
    noStroke();
    fill(0);

//middle flower
    //outer right
    fill(255,0,x,30+z*.15)
    ellipse(ellipseX+z, ellipseY, r, r);

    //white
    fill(255,255,255,30)
    ellipse(ellipseX, ellipseY, r, r);

    //outer left
    fill(255,0,x,30+z*.15)
    ellipse(ellipseX-z, ellipseY, r, r);

    //outer bottom
    fill(255,0,x,30+z*.15)
    ellipse(ellipseX, ellipseY+z, r, r);

    //white
    fill(255,255,255,30)
    ellipse(ellipseX, ellipseY, r, r);

    //outer top
    fill(255,0,x,30+z*.15)
    ellipse(ellipseX, ellipseY-z, r, r);

    //white center
    fill(255,255,255,5+.25*z)
    ellipse(ellipseX-0.7,ellipseY,2*z,2*z)
    ellipse(ellipseX+0.7,ellipseY,2*z,2*z)
    ellipse(ellipseX,ellipseY-0.7,2*z,2*z)
    ellipse(ellipseX,ellipseY+0.7,2*z,2*z)

    //center ellipses
    fill(255,0,x,30+z*.15)
    ellipse(ellipseX,ellipseY,2*z,z)
    ellipse(ellipseX,ellipseY,z,2*z)

    //magenta center
    fill(255,0,x+3*z,30+z*.15)
    ellipse(ellipseX,ellipseY,1.3*z,z)
    ellipse(ellipseX,ellipseY,z,1.3*z)

    //white center bud
    fill(255,255,255)
    ellipse(ellipseX,ellipseY,z*.1,z*.1)
  }

This week’s drawing is a blooming flower. I had originally wanted to do something more complicated but struggled with the code as is. I had Stella Han help me figure out how to create boundaries so that when it hit a certain height it would shrink again. I also had Shovik Mani help me figure out a bug in my code. Originally I had posted the function for keyPress inside the drawing function and couldn’t figure out why it wouldn’t draw.

jknip-Project-03-dynamic-drawing

sketch.js

// Jessica Nip
// Section A
// jknip@andrew.cmu.edu
// Project-03

var R = 0;
var G = 0;
var B = 0;
var R2 = 0;
var G2 = 0;
var B2 = 0;
var R3 = 0;
var G3 = 0;
var B3 = 0;
var R4 = 0;
var G4 = 0;
var B4 = 0;

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

function draw() {
    background(255,215,122);
    fill(R,G,B); // control rect color explicitly
    noStroke();
    var m = max(min(mouseX, 480), 0);
    var size = m * width / height/2;
    rect(m, mouseY, size, size);
    rect(m/2.2, mouseY, size/2, size/2);
    rect(m/7, mouseY, size/3, size/3);

	fill(R2,G2,B2);
    rect(m, mouseY/3, size, size);
    rect(m/7, mouseY/3, size/3, size/3);
    rect(m/2.2, mouseY/3, size/2, size/2);
   
   	fill(R3,G3,B3);
    rect(m, mouseY/1.6, size, size);
    rect(m/7, mouseY/1.6, size/3, size/3);
    rect(m/2.2, mouseY/1.6, size/2, size/2);

	fill(R4,G4,B4);
    rect(m, mouseY*1.5, size, size);
    rect(m/7, mouseY*1.5, size/3, size/3);
    rect(m/2.2, mouseY*1.5, size/2, size/2);

    stroke(255);
    strokeWeight(12);
    line(450, 0, mouseX, mouseY); // White line
    stroke(50);
    var mx = map(mouseX, 0, width, 180, 250);
    line(120, 0, mx, mouseY); // Black line

    if (mouseX > width/2) {
 		R = 146; //purple
 		G = 129;
 		B = 159;
 		R2 = 6; //blue
 		G2 = 67;
 		B2 = 90;
 		R3 = 45; //dark purple
 		G3 = 35;
 		B3 = 56;
 		R4 = 231; //peach
 		G4 = 165;
 		B4 = 150;

    } else if (mouseX > width/3) {
    	R = 196; //mauve/pink
    	G = 155;
    	B = 168;
    	R2 = 101; //lighter blue
 		G2 = 128;
 		B2 = 139;
 		R3 = 74; //purple
 		G3 = 48;
 		B3 = 76;
 		R4 = 231;// rich peach
 		G4 = 165;
 		B4 = 130;

    } else if (mouseX > 0 < width/3) {
    	R = 196; //light purple grey
    	G = 176;
    	B = 174;
    	R2 = 190; //lightest blue
 		G2 = 200;
 		B2 = 230;
  		R3 = 110; //pinkish purple
 		G3 = 66;
 		B3 = 87;
 		R4 = 231; //dark peach
 		G4 = 165;
 		B4 = 110;
    }

}











In this project, I wanted to play with ascending shapes in scale and gradients. I would love to incorporate more complex motion into this set in the future.

thlai-Project-03-Dynamic-Drawing

I had a lot of fun making this, although a large part of it was guess and check for the code I was not familiar with. I wanted it to look something like a kaleidoscope with 8 reflective sides, so I created a symmetrical and radial composition.

thlai-project-03

// Tiffany Lai
// 15-104, Section !
// thlai@andrew.cmu.edu
// Project 03 - Dynamic Drawing

var r; // RED
var g; // GREEN
var b; // BLUE

function setup() {
    createCanvas(640, 480);
    rectMode(CENTER);
    noStroke();
    fill(255, 150);
    sq1 = { // CENTER
        x: 0,
        y: 0,
        w: 100,
        h: 100,
    }
    sq2 = { // MIDDLE CIRCLE
        x: 150,
        y: 0,
        w: 100,
        h: 100,
    }
    sq3 = { // BG LINES
        x: 250,
        y: 0,
        w: 10,
        h: 10,
    }
}

function draw() {
    background(r, g, b);

    r = map(mouseX, 0, width, 100, 230); // BG (change colors)
    g = map(mouseY, 0, width, 150, 200);
    b = map(mouseX, 0, height, 200, 255);

    sq1.w = map(mouseX, 0, width, 20, 200); // CENTER SQUARE (change size with mouseX)
    sq1.h = map(mouseX, 0, width, 20, 200); 

    sq2.w = map(mouseX, 0, width, 100, 20); // CIRCLE OF SQUARES (change size with mouseX)
    sq2.h = map(mouseX, 0, width, 100, 20);

    sq3.w = map(mouseY, 0, height, 1, 200); // BACKGROUND LINES (change size with mouseX)
    sq3.h = map(mouseY, 0, height, 1, 500);


    translate(width/2, height/2);

    for (var i = 0; i < 16; i++) { // BACKGROUND LINES
        push();
        fill(r-10, g-10, b-10); // vertical lines
        rotate(TWO_PI * i / 16);
        rotate(radians(mouseX/50)); // rotation speed
        rect(sq3.x, 0, 5, sq3.h);

        rotate(TWO_PI * i / 16); // horizonal lines
        rotate(radians(mouseX/50)); // rotation speed
        rect(sq3.x, 0, sq3.w, 5);
        pop();
    }

    push(); // CORNER LINES
    strokeWeight(1);
    translate(-width/2, -height/2);
    stroke(r-30, g-30, b-30);
    line(0, 0, mouseX, mouseY); // line point follows mouse
    line(0, height, mouseX, mouseY);
    line(width, 0, mouseX, mouseY);
    line(width, height, mouseX, mouseY);
    pop();

    rotate(radians(mouseX/7)); // CENTER SQUARE
    rect(sq1.x, sq1.y, sq1.w, sq1.h);

    for (var i = 0; i < 8; i++) { // CIRCLE OF SQUARES is eight
        push();
        rotate(TWO_PI * i / 8);
        rotate(radians(mouseX/10)); // rotation speed
        rect(sq2.x, sq2.y, sq2.w, sq2.h);
        pop();
    }
}













thlai-LookingOutwards-03

 

 

Custom Jewelry – Nervous System

All of Nervous System’s (a generative design studio) projects are intriguing and inspired by natural phenomena, but their custom jewelry in particular caught my eye. These beautiful rings are truly one of a kind, as each fuses together art, science, and technology. Nervous System’s rings are inspired by natural phenomena such as cells and coral, and they are first 3D printed in wax then cast in metal.

What I admire most about Nervous System’s work is how many of their jewelry pieces are co-created with the client, meaning the client had a large role of co-designing via Nervous System’s app, Cell Cycle. Not much information is given on their process and the algorithms used to build their pieces, but their generative work is always grounded by their fascination of organic shapes and unconventional geometries, as stated in their biography. They design a system that generates these natural forms to create all sorts of pieces of art, and as generative art is, each piece is different than the last.

When I look at all of Nervous System’s work, it’s clear that they take a liking to certain patterns – a lot of their work look like nerves or coral – yet each is distinctive. That’s the beauty of generative artwork.

agusman-LookingOutwards-03: 4D Printing

The emergence of “4D printing”

Artist/Scientist: Skylar Tibbits

TED Talk: “The Emergence of 4D Printing”

When I observe the rapid pace at which technology and hardware is evolving, I have to think of all the technology and hardware that becomes immediately discarded as a result. The materials that we have used to build our homes, cities and products cannot provide us much more than what their static form allows, other than the ways we can use that form for creative reuse. So what will happen when our environment changes faster than we can build the proper tools and technologies?

Skylar Tibbits, Co-Director and founder of the Self-Assembly Lab at MIT, is proposing the manufacture and use of “programmable” materials that adapt to the changing environment. He calls this material phenomenon “Self-Assembly” and defines it as a process by which “disordered parts build an ordered structure through local interaction.” By creating responsive building blocks that are constructed and reconstructed by using small amount of energy and interaction, people can build tools that suit the needs of a changing environment. Skylar and his team have been building these “responsive building blocks” with the aid of 3D printing. He calls this process of printing self-constructing objects “4D printing”, as the 4th dimension is the element of change over time.

sntong-Project-03-Dynamic-Drawing

sketch

//Scarlet Tong
//Sectiom A
//sntong@andrew.cmu.edu
//Project-03-Dynamic-Drawing

var column = 64;
var loc = 30;
var dim = 30;
var R = 254;
var G = 254;
var B = 254;
var angle = 0;
var angleVar = 40;
var dir = 8;
var colorGo = false;

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

}

function draw(){
  background (0);
  var w = 0;
  var h = 0;

  // basic grid of square
  push();
  translate(width/2,height/2);
  angleMode(DEGREES);
  noStroke();
  rectMode(CENTER);
  fill(254);
  rect(w, h, dim,dim);//center rect
  rotate(angle);
  fill(R,G,B);//color pair 1
  rect(w-loc,h-loc,dim,dim);//rect a1
  rect(w+loc,h+loc,dim,dim);//rect a8
  //color pair 2
  fill(R+loc,G,B);
  rect(w,h-loc,dim,dim);//rect a2
  rect(w-loc,h,dim,dim);//rect A4
  //color pair 3
  fill(R,G+loc,B);
  rect(w+loc,h-loc,dim,dim);//rect a3
  rect(w-loc,h+loc,dim,dim);//rect a6
  //color pair 4
  fill(R,G,B+loc);
  rect(w+loc,h,dim,dim);//rect A5
  rect(w,h+loc,dim,dim);//rect a7
  pop();

  stepOne();
  stepTwo();
  // this resets the value for angle to make sure the squares rotate when
  //the mouse is going back and forth the canvas
  if (mouseX < column*2 || mouseX > column*9) {
    angle = 0;
  }

  stepThree();
  //this to make sur the random color generation does not continue
  if (mouseX < column) {
    colorGo = false;
  }

}

function stepOne(){
  if (mouseX >= column & mouseX <= column+column/2 && mouseX <= column*3) {
    //Translation of the sqaures away from the center
    loc = max(50);
    loc += mouseX-70;
    //scale each square larger
    dim += mouseX-140;
    dim = max(50);
  }
}

//rotation of outter squares
function stepTwo (){
  //rotating the outside squares if mouseX is between a certain range
  if (mouseX > column*4 & mouseX < column*9 && angle < 90) {
    angle += angleVar*dir;
    R = random(0,254);
    G = random(0,254);
    B = random(0,254);
  } if (angle >= 90  & colorGo == false) {//to stop rotation exceeding 90 degrees
    angle = 90;
    colorGo = true;
  } else {
    angleVar = 0.2*dir;
  }
}
//Collsping and combining the squares to make large square
function stepThree(){
  if(mouseX > column*7 & mouseX < width){
    loc += mouseX-400;
    loc = min(50);
  }
}

I had fun trying to create a simple sequence of motion starting from the idea of generating a part to whole. A large square splits into smaller modules, and there is a variety of color and rotation that makes them all different from the “original” module that is located in the middle. I had to plan out the steps by using hand sketch diagrams.

rkarp1 – LookingOutwards-03 – Frequencies

Frequencies” (2017) is a computational digital fabrication by convivial studio.

In “Frequencies,” a triptych of 3-D, map-like reliefs were made by CNC machines using Perlin Noise algorithm frequencies. The reliefs were meant to imitate rocky and fluid patterns, to match those often found on relief maps. According to convivial studio’s description of the project, “The generative application [used to make “Frequencies”] allows an infinite number of outcomes,” and so convivial studio sought to show a range of patterns across the triptych.

Here’s a video that details the creation of “Frequencies.”

I was intrigued by “Frequencies” for a number of reasons. For one, I’m in the early stages of a project about map-making (specifically with regards to redistricting), and I was curious to investigate map-making from a very different angle. In addition, I had just read about Perlin Noise in one of the required readings for our class, and I don’t know if I fully understand it but I am intrigued by it. I also love the combination of huge machines making very delicate-seeming art. I had to look up what a CNC machine is (read about it here) and I am looking forward to going down the rabbithole of other CNC machined artworks.

convivial studio used openFrameworks with add-ons including ofxMtlMapping2D, ofxFlowTools, ofxAutoReloadedShader for the generative 3D and projection software. They used artCam to generate the code needed for the CNC machine. A more detailed description is available here.

As seen in the video, a projection layer is added on top of the reliefs that, according to convival studio, “aims to challenge the perception of relief.” Personally, I found myself more interested in the reliefs themselves and the means by which they were made, but they do make for some striking images.

An image of “Frequencies” with its projection layer

convival studio, based in London, describes itself as working “at the intersection of art, design and technology. Merging the digital with the physical, convivial creates emotionally engaging experiences with an element of wonder.” I certainly felt wonder watching the creation of “Frameworks.” I hope you do, too!