Week 4: 3D Steering wheel of a car

Description 

create a generative typography/text output

Process:

I originally started with making a speedometer, but found this idea more fun and interactive so went along with it.

It took a lot of maths! I started with a rough circle/ellipse  for a  path for  my text to go about. Then I created the variable “arclength”  to trace the text on the the circular path. Then I iterated the arclength with each letter of the string and divided it by 2 to make it monospaced on an average.

I then created a variable theta for every angle of the letter of the string. Then through push and pop, I copied the translate and rotate coordinates of the text and pasted it again. Through mouseX function, the arc moved sideways along with the mouse.

Challenges: 

There was a little  math, which was a bit challenging for me. But once it worked, it was fun to interact with.  Initially, I used TWO_ PI as stop 2 value in map in translate, which gave it a 2D effect being the original plan. Then by just switching it to PI, the wheel switched to being 3D and it was fun so I let it be.

Here’s the video link to the assignment:

 

Code:

String message; 
PFont f;
float r = 300;// The radius of a circle


void setup() {
  size(800,800);
  // The message to be displayed
  message = "Steering wheel of the your car  Steering wheel of your car Steering wheel of your car Steering wheel of your car Steering wheel of your car";  //Speed of your wheels  Speed of your wheels  Speed of your wheels ";
  // The text must be centered!
  textAlign(CENTER);
  f = createFont("Serif",32);
  textFont(f);
  textSize(36);
}

void draw() {
  background(#98EAF7);

  // Start in the center and draw the circle
  translate(width / 2, height / 2);
  //noFill();
  //stroke(0);
  //ellipse(0, 0, r*2, r*2);

  // We must keep track of our position along the curve
  int arclength = 0;

  // For every letter
  for (int i = 0; i < message.length(); i++)
  {
    float w = textWidth(message.charAt(i));
    arclength += w/2;
    
    float theta = PI + arclength / r;    

    push();
    translate(r*cos(theta + map(mouseX, 0, width, 0, PI)), r*sin(theta+map(mouseX, 0, width, 0, TWO_PI)));
    
    rotate(theta+PI/2 +map(mouseX, 0, width, 0, TWO_PI)); // rotation is offset by 90 degrees
    
    // Display the character
    fill(0);
    text(message.charAt(i),0,0);
    pop();
    // Move halfway again
    arclength += w/2;
  }
}

 

Week 3 Assignment – Shanaia Paruthi

Description

Create a generative artwork using Object-Oriented Programming.

Process

I started with setting the background as black. This particular design has a monochrome theme, therefore I have only used the shades of black and white for this assignment.

I started by creating a spiral starting from the centre of the screen using the ellipse shape and sin and cos function to move it. I then created a circle in the centre and put its colour in a loop to give it an effect.

The main part of my design consisted of rotating square in the centre. By putting the square in a loop and a strokeWeight of 10, the square got its special effect. Then I increased the square angle  by 0.1 with every  frame.

VIDEO TO MY WORK:

https://youtu.be/lZz2NTa6jeU

//introducing variables 
float r = 0;
float theta = 0;
float angle;

void setup() {
  //setting the display size
  size(640, 480);
  
  background(0);//black
  fill (256/2,80); //grey
  circle(0, 0, 150);
}

void draw() {
  
  spiral();
  
  center(250);
  
  square();
}

void spiral(){
  //defining x coordinate to move the ellipse
   float x = r * cos(theta);
   //defining the y coordinate to move the ellipse
  float y = r * sin(theta);

  
  noStroke();
  //defning stroke Weight
  strokeWeight(0.5);
  //filling colour
  fill(random(100,150));
  translate(width/2,height/2);
  
  //creating the ellipse
  ellipse(x, y, 30, 30); 

  //increment of angle
  theta += 0.1;
  //increment of radius of the spiral
  r += 0.5;
}

void center(float h) {
  //defining the center circle 
  h-= 5;
  circle(0, 0, h+60);
  //giving it a zooming effect
  for (int i=0; i<angle; i++) {
    fill(100,80);
    line(h, h-2, h, i);
  }
  
  
}
void square(){
  //creating a loop
  for (int i=0; i<100; i++) {
    fill(random(100, 180), 85);
    stroke(0);
    strokeWeight(10);
    //scaling the square
    scale(0.95);
    
    //rotate
    rotate(radians(angle*1.5));
    
    //creating a rectangle
    rect(0, 0, 150, 150);
  }
  //increment of the angle
  angle+= 0.1;
}

 

Week 2: Design using loops

DESCRIPTION

Using loops (for() or while()) in some way, along with everything that you’ve learned so far, make a simple work of art.

PROCESS:

Background:   I started with giving my design a base by making the background of the design black. Thereafter, I used the loop function to create several triangles as I filled them with partially transparent shade of orange and a strong stroke to highlight the image. I had another similar idea in mind where instead of orange triangles, I wanted to use purple circles. In the end, I used to the “mousepressed” function to help me switch between the two. Here’s how the two turned out to be:

Foreground: After setting the background, I made a (sort of) flower in the middle as a part of my design, using the circle function as the the centre and the bezier function for the petals. Originally, I filled it with the colour black because it was going well with the orange background but then I used the random function for the colours when clicked using the mouse, to give it a mood-altering effect. I also change the circle’s diameter to random between 10 to 80 to give it a growing effect.

Finally I used the “keypressed” function, to give the final effect. For the last I saved the most difficult to figure out. I put the rectangles in a loop to create multiple of them, and used the rotate function and frameCount to put them in a circular motion giving it an aesthetic sense. A picture is also given below 🙂

Initially, It was challenging to make the design because of figuring out the rates and maths, but once I got the hang of it, it was extremely fun and satisfying.

void setup(){
  size(640,640); // size of the viewer
  background(0); //base
  //loop
  for( int i = 0; i<480;i++);
  };

//introducing the variables 
int centerX= 640/2;
int centerY=640/2;
int rectSize = 150; 
float angle;


void draw() {
  smooth();//smoothing the edges of the shapes
  //condition for the background
  if( mousePressed== true){
    fill(202,129,255,2);//purple
    stroke(202,129,255,155);
    strokeWeight(2);
 //loop
  for (int x = -40; x<= height; x+=40){
    for(int y= -30; y<= width; y+=30){
      circle(x ,y,80);
    }}
  } else {
    fill (255,190,70,2); //orange
    stroke(255,165,3,155);
    //loop
    for (int x = -40; x<= height; x+=40){
    for(int y= -30; y<= width; y+=30){
      triangle(x ,y,x-30,y+90,x+30,y+90);
    }}
  };
  //condition
  {if (mousePressed == true)
  {
  //filling with random colours with each frame
  fill(random(0,255),random(0,255),random(0,255));
  circle(centerX,centerY,random(10,80));//random diameter of circle
  //top petal
  bezier(centerX,centerY-35,centerX+40,centerY-40,centerX+20,centerY-160,centerX,centerY-200);
  bezier(centerX,centerY-35,centerX-40,centerY-40,centerX-20,centerY-160,centerX,centerY-200);
  //right petal
  bezier(centerX+35, centerY, centerX+40, centerY-40, centerX+160,centerY-20, centerX+200, centerY);
  bezier(centerX+35, centerY, centerX+40, centerY+40, centerX+160,centerY+20, centerX+200, centerY);
  //bottom petal
  bezier(centerX,centerY+35,centerX+40,centerY+40,centerX+20,centerY+160,centerX,centerY+200);
  bezier(centerX,centerY+35,centerX-40,centerY+40,centerX-20,centerY+160,centerX,centerY+200);
  //left petal
  bezier(centerX-35, centerY, centerX-40, centerY-40, centerX-160,centerY-20, centerX-200, centerY);
  bezier(centerX-35, centerY, centerX-40, centerY+40, centerX-160,centerY+20, centerX-200, centerY);
  //upper right petal
  bezier(centerX+30, centerY-35, centerX+75, centerY-10, centerX+145, centerY-90, centerX+185,centerY-150);
  bezier(centerX+30, centerY-35, centerX+55, centerY-130, centerX+145, centerY-120, centerX+185,centerY-150);
  //bottom left petal
  bezier(centerX-30, centerY+35, centerX-75, centerY+10, centerX-145, centerY+90, centerX-185,centerY+150);
  bezier(centerX-30, centerY+35, centerX-55, centerY+130, centerX-145, centerY+120, centerX-185,centerY+150);
  //upper left petal
  bezier(centerX-30, centerY-35, centerX-75, centerY-10, centerX-145, centerY-90, centerX-185,centerY-150);
  bezier(centerX-30, centerY-35, centerX-55, centerY-130, centerX-145, centerY-120, centerX-185,centerY-150);
  //bottom right petal
  bezier(centerX+30, centerY+35, centerX+75, centerY+10, centerX+145, centerY+90, centerX+185,centerY+150);
  bezier(centerX+30, centerY+35, centerX+55, centerY+130, centerX+145, centerY+120, centerX+185,centerY+150);
  } else {
    fill(0);//fill black
    stroke(0);
    //top petal
    bezier(centerX,centerY-35,centerX+40,centerY-40,centerX+20,centerY-160,centerX,centerY-200);
    bezier(centerX,centerY-35,centerX-40,centerY-40,centerX-20,centerY-160,centerX,centerY-200);
    //center
    circle(centerX,centerY,30);
    //right petal
    bezier(centerX+35, centerY, centerX+40, centerY-40, centerX+160,centerY-20, centerX+200, centerY);
    bezier(centerX+35, centerY, centerX+40, centerY+40, centerX+160,centerY+20, centerX+200, centerY);
    //bottom petal
    bezier(centerX,centerY+35,centerX+40,centerY+40,centerX+20,centerY+160,centerX,centerY+200);
    bezier(centerX,centerY+35,centerX-40,centerY+40,centerX-20,centerY+160,centerX,centerY+200);
    //left petal
    bezier(centerX-35, centerY, centerX-40, centerY-40, centerX-160,centerY-20, centerX-200, centerY);
    bezier(centerX-35, centerY, centerX-40, centerY+40, centerX-160,centerY+20, centerX-200, centerY);
    //upper right petal
    bezier(centerX+30, centerY-35, centerX+75, centerY-10, centerX+145, centerY-90, centerX+185,centerY-150);
    bezier(centerX+30, centerY-35, centerX+55, centerY-130, centerX+145, centerY-120, centerX+185,centerY-150);
    //bottom left petal
    bezier(centerX-30, centerY+35, centerX-75, centerY+10, centerX-145, centerY+90, centerX-185,centerY+150);
    bezier(centerX-30, centerY+35, centerX-55, centerY+130, centerX-145, centerY+120, centerX-185,centerY+150);
    //upper left petal
    bezier(centerX-30, centerY-35, centerX-75, centerY-10, centerX-145, centerY-90, centerX-185,centerY-150);
    bezier(centerX-30, centerY-35, centerX-55, centerY-130, centerX-145, centerY-120, centerX-185,centerY-150);
    //bottom right petal
    bezier(centerX+30, centerY+35, centerX+75, centerY+10, centerX+145, centerY+90, centerX+185,centerY+150);
    bezier(centerX+30, centerY+35, centerX+55, centerY+130, centerX+145, centerY+120, centerX+185,centerY+150);
  };
  
  }}; 
  
void keyPressed(){
      //condition
      if (key== 's');
      //for center
      translate(centerX,centerY);
      rectMode(CENTER);
      stroke(255,115); //white
      strokeWeight(3);
      noFill();
         //loop
        for(float a=0; a<360; a+=10){ 
       pushMatrix(); //saving the coordinate systerm
       rotate(radians(a)); //rotate
       rect(frameCount*rectSize*sin(radians(angle))*0.001,frameCount*rectSize*cos(radians(angle))*0.0001,rectSize,rectSize);//rectangle
       popMatrix();//restoring the coordintes saved
   };
   angle++;//increasing the angle
};

 

Week: 1 Self Portrait – Shanaia Paruthi

Description of the Assignment: 

We were asked to create a self-portrait using simple drawing functions taught in class. I used ellipse, circle, rectangle, arc and triangle to do the same.

Process:

I started this assignment with a rough sketch in my notebook where I determined which shapes to use and what to use them for. Furthermore, I also looked into the colour scheme, and what will bring out my sketch even more.

Please click the link to see  the  sketchStarting sketch

I started by painting the background with a violet shade, then went on to use the ellipse for the face. Since I love wearing caps, I made my sketch wear a cute cap using arc for the head and the ellipse as a visor/bill.

Then I continued to make the hair using the rectangle function. The rectangle function was also used to make the neck and the arc was used to give the shirt a neckline.

Then came the torso, which I again used the rectangle function for. Intially I thought of using the triangle function to give the shirt sleeves, but I believe the arc function fits it better so I went along with the arc function. Once again, I used the rectangle function to give the shape of hands/arms to the figure.

Now for the challenging part of the sketch, I had to draw the features of the sketch. I used the ellipse for the eyes and circle for its pupils. Comparing the dimensions set for the eyes, I used the arc function to make the eyebrows and eyelashes. I made the nose using triangle function.  For the lips, I used two arc functions for upper lips and one arc function for lower lip. I also used the arc function to create ears for my figure. Finally, for the finishing touch I gave the self-portrait a mole similar to mine.

Overall,  this was extremely fun and rewarding!

CODE:

int centerX;
int centerY;

//size of viewer
void setup(){
  size(640,480);
  background(206,72,237);
  centerX = width/2;
  centerY = height/2;
};

void draw(){ 
  //hair 
  fill(113, 73, 19);
  rect((centerX)-110, (centerY)-60, 210, 250); 

  //hands
  stroke(0);
  fill(240, 184, 111);
  rect((centerX)-75, (centerY)+170, 20, 90);
  rect((centerX)+55, (centerY)+170, 20, 90);
  
  
  //body
  stroke(29, 59, 222);
  fill(29, 59, 222);
  rect((centerX)-50, (centerY)+150, 100, 130); //torso
  arc((centerX)-55, (centerY)+175, 50, 50, radians(180), radians(360));// sleeves
  arc((centerX)+55, (centerY)+175, 50, 50, radians(180), radians(360));//sleeves
  
  //neck
  stroke(0);
  fill(240, 184, 111);
  rect((centerX)-18, (centerY)+100, 30, 50);
  arc((centerX)-3, (centerY)+150, 30, 30, radians(360), radians(540));
  
  
  //face
  ellipse(centerX, centerY, 180, 220);
  
  //nose
  triangle((centerX), centerY, (centerX)+5, (centerY)+20, (centerX)-5, (centerY)+20);
  
  //cap
  stroke(29, 59, 222);
  fill(29, 59, 222);
  arc((centerX), (centerY)-60, 230, 150, radians(180), radians(360));
  noStroke();
  ellipse((centerX)+80, (centerY)-80, 150, 50);
  
  //eyes
  stroke(255);
  fill(255);
  ellipse((centerX)+45, (centerY)-20, 35, 10); 
  ellipse((centerX)-45, (centerY)-20, 35, 10);
  stroke(0);
  fill(0);
  circle((centerX)+45, (centerY)-20, 10);//pupil
  circle((centerX)-45, (centerY)-20, 10);//pupil
  
  //eyebrows
  arc((centerX)+45, (centerY)-40, 35, 10, radians(180), radians(360));
  arc((centerX)-45, (centerY)-40, 35, 10, radians(180), radians(360));
  
  //eyelashes
  arc((centerX)+45, (centerY)-25, 40,7, radians(135), radians(360));
  arc((centerX)-45, (centerY)-25, 40,7, radians(180), radians(405));
  
  
  //lips
  fill(255, 0, 0);
  stroke(229, 12, 66);
  arc((centerX)-10, (centerY)+65, 25,15, radians(180),radians(360));
  arc((centerX)+10,(centerY)+65,25,15,radians(180),radians(360));
  arc((centerX), (centerY)+66, 50, 30, radians(0), radians(180));
  
  //mole
  stroke(0);
  fill(0);
  circle((centerX)-20, (centerY)+40, 3);
  
  //ears
  fill(240, 184, 111);
  arc((centerX)-88, (centerY), 20, 40, radians(90), radians(270));
  arc((centerX)+88, (centerY), 20, 40, radians(270), radians(450));
};