week 4 assignment: typography/ text output

INSPIRATION

I created this piece to demonstrate how relatively easy to fall into old habits and spiral downward and, on the flip side, how difficult it is to recover, relapse, and then get clean again.

PROCESS

First I made these two sentences exploded. With every DOWN key pressed, the alphabets move faster and it gets darker until it’s completely pitch black.

Then, if you start clicking the UP button, the background begins to get brighter and the alphabets begin to shrink. Until it suddenly cuts to black, and then it brightens up, with the words too small to register.

DEMO

CODES

// a string of text
String s = "stupid mistake "; 
String t = "why did you do?";

// declare an array of Circle objects, called letters
// set it to be the same size as the length of the String
Letter letters[] = new Letter[s.length()];
Letter letters1[] = new Letter[t.length()];

PFont f;
int fontSize = 25;
int bg = 255;

void setup(){
  size(450, 450);
  f = createFont("Skia-Regular_Black-Extended", 25);
  textFont(f);

  // radius of the  circle of letters
  int radius = 50;
  int radius1 = 75; 
  
  // start the words halfway around the circle 
  // (left side. normally in processing circles, angles, and rotations 
  // start on the right side) 
  float startingAngle = PI;
  
  // where is the center of the circle
  float circleCenterX = width/2;
  float circleCenterY = height/2;
  
  // loop through all the characters in the String
  for (int i =0; i<s.length();i++){
     // the get the angle using i as a multiplier
     float angle = startingAngle + i*TWO_PI/s.length();
     
     // cosine of an angle equals adjacent/hypoteneuse 
     // thus: cos(angle) = x/radius 
     // and algebra: x = cos(angle)*radius
     float x = cos(angle)*radius + circleCenterX+random(-2, 2)*noise(frameCount*.01);
     // y is same but sine
     float y = sin(angle)*radius + circleCenterY+random(-2, 2)*noise(frameCount*.01);
     
     //make a new Circle object for each letter
     letters[i] = new Letter(x, y, s.charAt(i));
  }
  
   for (int l =0; l<t.length();l++){
     // the get the angle using i as a multiplier
     float angle = startingAngle + l*TWO_PI/t.length();
     
     // cosine of an angle equals adjacent/hypoteneuse 
     // thus: cos(angle) = x/radius 
     // and algebra: x = cos(angle)*radius
     float x1 = cos(angle)*radius1 + circleCenterX;
     // y is same but sine
     float y1 = sin(angle)*radius1 + circleCenterY;
     
     //make a new Circle object for each letter
     letters1[l] = new Letter(x1, y1, t.charAt(l));
  }
}

void draw(){
  background(bg);
  textSize(fontSize);
  // loop through the letters array and call all needed functions
  for (int i =0; i<s.length();i++){
     letters[i].update();
     letters[i].display();
     letters[i].checkEdges();
     letters1[i].update();
     letters1[i].display();
     letters1[i].checkEdges();
  }  
}

// when the down and up key is pressed assign a random x & y speed and changes background color 
void keyPressed(){
  if (key == CODED && keyCode == DOWN){
       for (int i =0; i<s.length();i++){
        letters[i].xSpeed = random(-5*i,5)*noise(frameCount*.01+i*0.01);
        letters[i].ySpeed = random(-5,5*i)*noise(frameCount*.01+i*0.01);
        letters1[i].xSpeed = random(-5,5*i)*noise(frameCount*.01+i*0.01);
        letters1[i].ySpeed = random(-5*1,5)*noise(frameCount*.01+i*0.01); 
        }
        fontSize += 25;
        bg -=20;
          if (bg<30){
        bg = 0;
        }
  }
    else if (key == CODED && keyCode == UP){
        for (int i =0; i<s.length();i++){
          letters[i].xSpeed = random(-5/(i+1),5/(i+1))*noise(frameCount*.01+i*0.01);
          letters[i].ySpeed = random(-5/(i+1),5/(i+1))*noise(frameCount*.01+i*0.01);
          letters1[i].xSpeed = random(-5/(i+1)/(i+1),5)*noise(frameCount*.01+i*0.01);
          letters1[i].ySpeed = random(-5/(i+1),5/(i+1))*noise(frameCount*.01+i*0.01);
        }
        if (bg <255){
          bg += 10;
        }
        else {
            bg = 255;
          }
        if(fontSize >=5){
          fontSize -= 10; 
        }
        else {
          fontSize = 1;
        }
  }
}
class Letter {
  float x, y;
  float xSpeed, ySpeed;
  char letter;
  int fontSize; 

  Letter(float _x, float _y, char _c) {
    x = _x;
    y = _y;
    xSpeed = ySpeed = 0;
    letter = _c;
  }

  void update() {
    x += xSpeed;
    y += ySpeed;
    xSpeed *= .90;
    ySpeed *= .90;
  }

  void display() {
    fill(0);
    text(letter,x,y);
  }

  void checkEdges() {
    if (y>height) {
      y=0;
    }
    if (y<0) {
      y=height;
    }
    if (x>width) {
      x=0;
    }
    if (x<0) {
      x=width;
    }
  }
}

Assignment 3: project oriented programming

inspiration & CONCEPT: Haunting Questions, Bursting Emotions

I intended to create repeating shapes and have them follow around the cursor. The mushrooming question marks describe the unfading nature of problems that never seem to go away. It shows how questions and emotions can loom in our minds and pulsate with time.

VIDEO DEMO

the codes

Twist [] myTwist;            

void setup() {
  size(1280, 720);
  
  //constructor
  myTwist = new Twist[25];
  for (int i=0; i<myTwist.length; i++){
    myTwist[i] = new Twist(i);
  }
}

//EXECUTION
void draw() {
  //background
  for (int i = 0; i < 1280; i += 128) {
    noStroke();
    fill(0+i/64*16*random(-10, 10)*noise(frameCount*0.01),49+i/64,156+i/64, 30);
    rect(0+i, 0, 128, 720);
  }
  
  //bursting emotions (two groups of circles )
  for (int i = 0; i<myTwist.length/2; i++){
    myTwist[i].runTwist();
    
    pushMatrix();               //save current coordinate system to the stack
    translate(50, 75);          //take the anchor coordinates from (0,0) to (width/2, height/2)               
  for (int l = myTwist.length/2; l<myTwist.length; l++ ) {
    tint(255, 156);
    myTwist[l].runTwist();
  }
    popMatrix();                //restore coordinate system
  }
}
//CLASS VARIABLES
class Twist{ 
  float posX, posY;     //inital coordinate of the circles
  float easing = 0.05;  //speed of the circles
  float diameter;       //size of circles
  color circleColor;    //color of the circles
  float speed;          //dictates how fast the circles move
  
//CONSTRUCTOR
Twist(float _speed){
  circleColor = color(200, 100, 100, 30);
  diameter = 100;
  speed =_speed;
}

//FUNCTIONALITY
//executes all functions 
void runTwist(){
  drawCircles();
  sizeCircles();
  drawText();
}

void drawCircles(){
  fill(circleColor);
  noStroke();
 //makes circles follow the cursor
  float targetX = mouseX;
  float dx = targetX - posX;
  posX += dx * easing * speed;
  
  float targetY = mouseY;
  float dy = targetY - posY;
  posY += dy * easing*speed;
  
  circle(posX+random(-10, 10)*noise(frameCount*0.01), posY+random(-10, 10)*noise(frameCount*0.01), diameter);
}

  //generates random question marks and the text in the middle of the circle
void drawText(){
  fill(255);
  text("why", mouseX, mouseY);
  fill(255, 180);
  text("?", random(width)-50, random(height/2)+400);
}

  //controls the size of circles
void sizeCircles(){
     diameter +=3;
  if (diameter>250){
    diameter = 100;
  }
}
}

PROBLEMS

Initially, I tried to create a group of circles that enlarges and shrinks to mimic a heart pulsating with its left ventricle. It does look like it’s pumping and it doesn’t look like a heart to begin with. I ay have to control the speed of the size changing and draw better next time.

artwork

This would be simple recurring and moving rectangles. When ‘l’ is pressed, the entire color palette would alter. It was created to give a mesmerizing effect that helps the audience relax.

void setup(){
  size (640, 480);
}
int rectWidth = width/10;
int rectHeight = height/10;
float bg, up, mid, down;

void draw(){
   
  if (keyPressed && key == 'l') {
    background(#E7F2F8); 
   noStroke();
   fill(#74BDCB);
  for (int i =rectHeight/2; i<height; i+=rectHeight){   
    rect((height+random(-2,2))*noise(frameCount*.01+i*0.5), i, 300, rectHeight);
  }
  
  stroke(255);
   fill(#FFA384);
  for (int i =rectWidth/2; i<width; i+=rectWidth){
    rect(i, (height/2+random(-2,2))*noise(frameCount*.01+i*0.2), rectWidth, 100);
  }
  
  fill(#EFE7BC);
   for (int i =rectWidth/2; i<width; i+=rectWidth){
    rect(i, (height+random(-2,2))*noise(frameCount*.01+i*0.08), rectWidth, 100);
  }
  } 
  else {
   
    background(#EED6D3); 
   noStroke();
   fill(#FFAEBC);
  for (int i =rectHeight/2; i<height; i+=rectHeight){   
    rect((height+random(-2,2))*noise(frameCount*.01+i*0.1), i, 300, rectHeight);
  }
  
  stroke(255);
   fill(#B4F8C8);
  for (int i =rectWidth/2; i<width; i+=rectWidth){
    rect(i, (height/2+random(-2,2))*noise(frameCount*.01+i*0.1), rectWidth, 100);
  }
  
  fill(#FBE7C6);
   for (int i =rectWidth/2; i<width; i+=rectWidth){
    rect(i, (height+random(-2,2))*noise(frameCount*.01+i*0.1), rectWidth, 100);
  }
  }
   
 
}

 

Self-Portrait Chi-Ting Tsai

In general, I decided to not do a realistic or cartoonish portrait as I think animals would reflect more of my spirits and character.

At first, I drew a pair of split eyes and a red nose. I intentionally left out the ears because my friends would always make fun of me for not understanding the conversation and recognizing people. I also make the background with color gradient rectangles. I enjoy bubbly and dreamy colors. Hence the background. 

Then, I was pondering over what I should do for its legs and tail. Not being inspired by anything, I started messing around with beziers and using for loops to create different effects. It proceeded to become wings and clouds in the image below.  

Oh! Also, three strands of hair popped out from the scalp.

This self-portrait reflected all my social character traits and my free spirits that will keep on exploring new avenues.

Challenges:

It was difficult to fully translate and execute my design in processing. My technical skills could not match my imagination, so I chose to try different functions to gain inspiration instead. I had a strong urge to drag the shapes around as I am used to drawing with Illustrator and Pro-Create. However, once I got familiar with the coordinate system, everything else went smoothly.