Project 4: String art

Yash string art

// Yash Mittal
// Section D

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 numLines = 30;

function setup() {
    createCanvas(400, 300);
    background (0);
    stroke (255);
    line (70, 200, 180, 10); // reference line 1 
    line (330, 180, 290, 70); // reference line 2
    strokeWeight (0);
    line (150, 290, 250, 260); // reference line 3
    line (100, 100, 200, 200); // reference to line 4 
    stroke ("white");
    line (30, 70, 290, 110); // reference to line 5
    strokeWeight (1);
    line (20, 20, 110, 10); // reference to line 6


    dx1 = (180 - 70) / numLines;
    dy1 = (10 - 200) / numLines;
    dx2 = (290 - 330) / numLines;
    dy2 = (70 - 180) / numLines;
    dx3 = (250 - 150) / numLines;
    dy3 = (260 - 290) / numLines;
    dx4 = (200 - 100) / numLines;
    dy4 = (200 - 100) / numLines;
    dx5 = (290 - 30) / numLines;
    dy5 = (110 - 70) / numLines; 
    dx6 = (110 - 20) / numLines;
    dy6 = (10 - 20) / numLines;

}

function draw() { 

    var x1 = 70;
    var y1 = 200;
    var x2 = 330;
    var y2 = 180;
    var x3 = 150;
    var y3 = 290;
    var x4 = 100; 
    var y4 = 200;
    var x5 = 30;
    var y5 = 290;
    var x6 = 20;
    var y6 = 20;
    var x7 = 110;
    var y7 = 10;

    for (var i = 0; i <= numLines; i = i + 0.9) { // center lines (left to right)

        line (x1, y1, x2, y2);
       
        x2 = x2+ dx2;
        y2 = y2 + dy2;
        
    }

    stroke ("yellow");

    for (var i2 = 0; i2 <= numLines; i2 = i2 + 3) { // bottom lines (bottom left to top)

        line (x2, y2, x3, y3);
        x2 = x2 + dx3;
        y2 = y2 + dy3;
        x3 = x3 + dx3;
        y3 = y3 + dy3;

    }


    stroke ("white");

    for (var i5 = 0; i5 <= numLines; i5 = i5 + 0.5) {

        line (x4, y4, x5, y5);

        x5 = x5 + dx5;
        y5 = y5 + dy5;
    }


 stroke ("red");

    for (var i3 = 0; i3 <= numLines; i3 = i3 + 1) { // top lines (top right to top center)

        line (x2, y2, x1, y1);
        x2 = x2 + dx3;
        y2 = y2 + dy3;
        x1 = x1 + dx1;
        y1 = y1 + dy1;
    }

    for (var i4 = 0; i4 <= numLines; i4 = i4 + 0.1) { 

        line (x3, y3, x2, y2);

        x3 = x3 + dx3;
        y3 = y3 + dy3;
        x2 = x2 + dx2;
        y2 = y2 + dy2;
        
}

    stroke ("yellow");
    strokeWeight (0.4);

    for (var i6 = 0; i6 <= numLines; i6 = i6 + 0.8) {

        line (x1, y1, x3, y3);

        x1 = x1 + dx1 / 2;
        y1 = y1 + dx1 / 2;
        x3 = x3 + dx3 / 2;
        y3 = y3 + dy3 / 2;
    }

    stroke ("red");

    for (var i7 = 0; i7 <= numLines; i7 = i7 + 0.5) {

        line (x6, y6, x4, y4);
        x4 = x4 + dx4;
        y4 = y4 + dy4;
    }

    strokeWeight (0.3);
    stroke ("red");

    for (var i8 = 0; i8 <= numLines; i8 = i8 + 0.1) {

        line (x7, y7, -x4, y4);
        x7 = x7 + dx6;
        y7 = y7 + dx6;
       
    }

noLoop();

}

I had fun working on this project. At first, I struggled to understand the mathematics behind the code but once I got the hang of it, it became pretty easy to draw new patterns on different parts of the canvas.

LO: Sound Art

For this week’s project, I chose a project called “Soundmachines” by Yannick Labbe, which are basically three units, resembling standard record players; and they translate concentric visual patterns into control signals so that a music software can process them. The rotation of these three units / discs, each holding three separate individual tracks, can be synced to a sequencer. I thought that this project was really cool and unique because of how simple it is to use but also the algorithm used to develop this was probably very complicated since picking up data from just a rotating disk and analyzing that data seems like a big task. In addition to this, I was really impressed with how the algorithm was able to combine individual music points from all three discs into one cohesive piece that was audibly pleasing.

Link to “Soundmachines” by Yannick Labbe – https://www.youtube.com/watch?v=_gk9n-2lBb8

Screenshot from “Soundmachines” Youtube video

Project 3: Dynamic drawing

sketch
// Yash Mittal
// Section D
 
var r = 100;
var g = 60;
var b = 150;
var angle = 30;
var sizeX = 70;
var sizeY = 70;

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

}

function draw() {

    background (r + mouseX, g + mouseY / 2, b + 10);

    frameRate(50);

    push(); //rectangle 1
    fill (r + mouseX - mouseY, g + mouseX, b + mouseY);
    translate (width / 2, height / 2);
    rotate (radians(angle));
    rectMode(CENTER);
    rect (mouseX / 2 , mouseY / 2, sizeX + mouseX / 2, sizeY + mouseY /2 );
    angle += 2;
    pop();
    
    push(); //rectangle 2
    fill (r + mouseX / 3 - mouseY / 2, g + mouseX + 50, b + mouseY - 100);
    translate (width / 2, height / 2);
    rotate (radians(angle) + 10);
    rectMode(CENTER);
    rect (mouseX / 2 , mouseY / 2, sizeX + mouseX / 2, sizeY + mouseY /2 );
    angle += 2;
    pop();
    
    push(); //rectangle 3
    fill (r - mouseX + mouseY * 2, g - mouseX + 10, b + mouseY / 2 + 100);
    translate (width / 2, height / 2);
    rotate (radians(angle) + 30);
    rectMode(CENTER);
    rect (mouseX / 2 , mouseY / 2, sizeX + mouseX / 2, sizeY + mouseY /2 );
    pop();

    push(); // rectangle 4 
    fill (r - mouseY - mouseX * 4, g - mouseX + 40, b + mouseX / 5 + 200);
    translate (width / 2, height / 2);
    rotate (radians(angle) - 10);
    rectMode(CENTER);
    rect (mouseX / 2 , mouseY / 2, sizeX + mouseX / 2, sizeY + mouseY /2 );
    pop();

    push(); // rectangle 5 
    fill (r - mouseY + 40 - mouseX * 7, g + mouseX / 2 + 200, b + mouseX + mouseY - 200);
    translate (width / 2, height / 2);
    rotate (radians(angle) - 30);
    rectMode(CENTER);
    rect (mouseX / 2 , mouseY / 2, sizeX + mouseX / 2, sizeY + mouseY /2 );
    pop();
    
    noStroke();

    var m = max(min ( mouseX, 600 ), 0 ); 
    var size = m * 350 / 600;

    fill(r + mouseY / 4, g - mouseY / 2, b + mouseY); // bigger circle fill
    ellipse (width / 2, height / 2, size); // bigger circle 

    fill(r - mouseY /2 + mouseY, g + mouseY / 4, b + mouseX); // smaller circle fill
    ellipse (width / 2, height / 2, size - 50); // smaller circle 


    var size1 = m * 350 / 600; // size for movaeble circle

    var w = constrain (mouseX, width / 2 - 1, width / 2 + 1); // x constrain
    var z = constrain (mouseY, 200, 250); // y constrain

    fill(r + mouseX, g - mouseY * 4, b + 20); // moveable circle fill 
    ellipse (w, z, size1 - 100); // moveable circle 
    

}

This project was really fun but also significantly harder. The part I struggled with the most was trying to get all the elements in the composition to be symmetrical and rotate / move at the same speed.

LO: Computational Fabric

For this week’s blog, I chose the project ‘Glass’ by Mediated Matter Group at MIT Media Lab. I initially came across the MIT Media Lab in the Netflix show called Abstract. This project stood out to me because of the fact that I had no idea about how flexible / versatile glass can be if used with proper technology and algorithms. It was very impressive seeing how the 3D printer’s algorithms layers the melted glass on top of each other in a way that it does not spill over or ruin the design. The versatility that is enabled by the geometrical and optical variation driven by the form, transparency and color variation can manipulate the light emissions and the reflections, making the glass much more complicated than I had thought of.

Link to ‘Glass’ by Mediated Matter Group – https://www.media.mit.edu/projects/g3p/overview/

Example of 3D printed glass objects

LO: Generative art

This week, I chose Marius Watz’ work called ‘ABSTRACT01js’ created in 2010. I found this computational art piece very interesting because of it’s pseudo-random elements that are the underlying algorithm of the art. The composition of the piece when the mouse is pressed is random but is comprised of the same elements, making the shape and colors somewhat consistent. It’s really cool to think how something as technical as coding can be used to create such an organic and flowing piece; Watz did a really good job at projecting the abstract randomness in a complicated yet sensible way. To do this, my guess would be that he used probability distributions to induce randomness to get this kind of patter. The interactive aspect of this art is what stood out to me; random patterns are created when I press the mouse on the canvas, which is something we learnt to do in class.

Link to ‘ABSTRACT01js’ – http://mariuswatz.com/works/abstract01js/

‘Abstract01js’ by Marius Watz

Project 2: Variable faces

sketchYash-variable faces

//Simple beginning template for variable face
var eyeSize = 40;
var faceWidth = 400;
var faceHeight = 400;
var noseWidth = 3;
var mouth = 1;
var hair = 1;
var body = 100;


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

   background (250);

    fill (239, 230, 131); // hands fill
    ellipse (200, 320, 50, 50); // right hand
    ellipse (440, 320, 50, 50); // left hand

    fill (255, 153, 52); // body fill 
    ellipse (width / 2, height / 2 + 100, body, body + 50); // body

    fill (107, 183, 216);

   ellipse(width / 2, height / 2, faceWidth,  faceHeight); // face shape

   fill ( 0, 0, 0 );
   stroke (254, 211, 66);
   strokeWeight (2);

    var eyeLX = (width / 2 - faceWidth * 0.25); 
    var eyeRX = (width / 2 + faceWidth * 0.25);
    ellipse(eyeLX, height / 2, eyeSize, eyeSize);
    ellipse(eyeRX, height / 2, eyeSize, eyeSize);

    stroke ( 0, 0, 0); 
    strokeWeight(1);
    fill( 228, 129, 203 );

   if (mouth < 0.33) { // rect mouth
        rect ( width / 2 - 10, height / 2 + 30, 40, 20 );

   } else if ( mouth < 0.66 ) { // line mouth
        line (( width / 2 - 20 ),( height / 2 +30 ), ( width / 2 + 30 ),( height / 2 +40));

   } else if ( mouth < 1 ) {  // ellipse mouth
        ellipse ( width / 2, height / 2 + 30, faceWidth / 2, faceHeight / 8);

   }

    fill (49, 50, 52);
    strokeWeight (1);

    if (noseWidth <= 1) { // nose 1
        triangle (width / 2, height / 2, width / 2 + 10, height / 2, width / 2 + 5, height / 2 + 10);

    } else if (noseWidth <=2) { // nose 2
        triangle (width / 2 - 5, height / 2  + 3, width / 2 + 8, height / 2 + 1, width / 2 + 3, height / 2 + 16);

    } else if (noseWidth <=3) { // nose 3
        triangle (width / 2 - 5, height / 2 +5, width / 2 + 6, height / 2 + 2, width / 2 + 15, height / 2 + 7); 

    }

    
}

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, 350);
    faceHeight = random(100, 250);
    eyeSize = random(10, 30);
    mouth = random(0,1);
    noseWidth = random(0,3);
    body = random (200, 250);
}

I struggled with understanding how to manipulate variables in a randomized order but I had fun writing this code as it was satisfying to see it actually work at the end.

Project 1: My Self Portrait

Yash-self portrait

//Yash Mittal
// Section D
function setup() {
    createCanvas(600,700);
    background(255,196,206);
}

function draw() {
    noStroke();
    fill(34,10,11);
    ellipse(300,360,230,80); //shoulder
    fill(150,117,86);//neck
    quad(280,300,320,300,340,340,260,340); //neck
    ellipse(300,340,80,40); //neck ellipse
    fill(80,77,67);//shadow
    ellipse(315,325,33,10);
    quad(260,290,318,290,332,325,300,327);//shadow
    fill(150,117,86);
    ellipse((width/2),(height/2)-140,150,200); //face
    fill(34,10,11);
    rect(186,360,228,240);//main body
    fill(255,243,139);//belt
    rect(186,600,228,20);
    fill(81,192,248);//legs
    rect(186,620,85,200);
    rect(329,620,85,200);
    fill(34,10,11);//arms
    rotate(20/3.0);
    ellipse(320,388,60,300);
    rotate(20/3.0);
    ellipse(530,-120,63,300);
    fill(150,117,86); // hands
    ellipse(489,365,60,60); // left hand
    ellipse(530,-250,63,63)//right hand
    fill(35,42,51);//glasses
    stroke(255,243,139);
    strokeWeight(2);
    ellipse(325,-55,40,40);
    ellipse(365,-94,40,40);
    line(312,-40,291,-25);
    line(380,-110,395,-128);
    line(341,-71,350,-80)
    stroke(1,0,0);//mouth
    line(386,-10,415,-30);
    line(300,-74,320,-85);//eyebrows
    line(335,-100,350,-120);
    noStroke();//hat
    rotate(-40/3.0);
    fill(223,103,72);
    ellipse(300,128,180,30);//hat
    rect(250,70,100,70);
    ellipse(300,70,100,30)
    fill(211,213,216);//hat highlight
    arc(265,132,100,9,TWO_PI,PI);
    arc(274,110,50,6,TWO_PI,PI);
}
    

The most challenging part about this project was definitely trying to arrange the elements in their proper exact location. It took me a lot of attempts to get, for example the shadow, to line up perfectly with the rest of the elements.

LO: My Inspiration

I chose ‘Future Sketches’ displayed in Artechouse, DC by the coding artist Zach Lieberman for this blog because I really admire how he is able to create such interactive and immersive experience using a scary medium like coding, which is often not usually considered an essential tool for creating these kinds of artistic experiences. The exhibit in Artechouse was designed and executed by Zach Lieberman and his team of artists using the coding language C++ and a C++ toolkit for creative coding called “openFrameworks” which he co-founded. The main idea of ‘Future Sketches’ is that it uses data from human input and manipulates in real time to produce very creative and fun outputs that the audience can further interact with, example – one piece in the exhibition analyses audience’s facial expressions, matches the expressions with other faces in the database and replaces some features of the face with those of the matched faces. This kind of technology is appealing to me because it shows coding in a new light that most people do not know about. This project highlights how creative coding can be used to create futuristic experiences that encourage interaction from the audience and produces outputs based on audience’s data in real time.

Link to his work ‘Future Sketches’- https://www.artechouse.com/program/future-sketches/

Example of Zack Liberman’s work displayed in Artechouse