GIF – Swetha

GIF_proj

These animated gifs were hard for me to do mostly because I have not done anything like this before. I really enjoyed some of the pieces Golan showed us which were abstract but interesting so I strived to emulate that in my gifs. The process thought me a lot however I didn’t quite feel satisfied with the pieces I did. Many of the pieces underwent lots of revision as I tried to figure out helpful ‘tricks’ in my code that can help me in both this piece and many more to come. Tricks such as the one Golan showed us on the gif which only used as much frames as it took one blue dot to get to the next blue dot. The pieces I produce do have that experimental quality that I liked about Davidope’s work, however, I feel like there is more that can be done with them to take them to a new level. I will be working more on these outside of class because I definitely think that they have the potential to be much greater.

Some Sketches:

Originally, the wave formations were going to be different but I ended up taking another route.

photo 2 photo 3 photo

Here is the code:

 

 

// Global variables. 
int     num = 1;
int     nFramesInLoop = 120;
int     nElapsedFrames;
boolean bRecording; 

//===================================================
void setup() {
  size (500, 200); 
  bRecording = false;
  nElapsedFrames = 0; 
}
//===================================================
void keyPressed() {
  bRecording = true;
  nElapsedFrames = 0; 
}

//===================================================
void draw() {

  // Compute a percentage (0...1) representing where we are in the loop.
  float percentCompleteFraction = 0; 
  if (bRecording) {
    percentCompleteFraction = (float) nElapsedFrames / (float)nFramesInLoop;
  } else {
    percentCompleteFraction = (float) (frameCount % nFramesInLoop) / (float)nFramesInLoop;
  }

  // Render the design, based on that percentage. 
  renderMyDesign (percentCompleteFraction);

  // If we're recording the output, save the frame to a file. 
  if (bRecording) {
    saveFrame("output/myname-loop-" + nf(nElapsedFrames,4) + ".png");
    nElapsedFrames++; 
    if (nElapsedFrames < (nFramesInLoop+1)) {
      bRecording = false;
    }
  }
  saveFrame("GIFS"+str(nElapsedFrames)+".png");
}

//===================================================
void renderMyDesign (float percent) {

  // This is an example of a function that renders a temporally looping design. 
  // It takes a "percent", between 0 and 1, indicating where we are in the loop. 
  // This example uses two different graphical techniques. 
  // Use or delete whatever you prefer from this example. 
  // Remember to SKETCH FIRST!

  //----------------------
  // here, I set the background and some other graphical properties
  background (180);
  smooth(); 
  stroke (0,0,0); 
  strokeWeight (2); 

  //----------------------
  // Here, I assign some handy variables. 
  float cx = 100;
  float cy = 100;

  //---------------------
  //----------------------
  // Here's a pulsating ellipse
  //float ellipsePulse = sin ( 3.0 * percent * TWO_PI); 
  background(255*(num%2));
  //nElapsedFrames+=1;
  float ellipseW = nElapsedFrames*5%(width+150); 
  float ellipseH = nElapsedFrames*5%(width+150); 
  //float ellipseColor = map(ellipsePulse, -1,1, 128,255); 
  fill (255*(1-(num%2))); 
  ellipse (width/2,height/2, ellipseW, ellipseH);
  nElapsedFrames+=1;
  if(nElapsedFrames*5%(width+150) == 0){
     num+=1;
   }

  int counter = 0;
  while(counter<=30)
   {
    for (int sy=0; sy < height; sy+=4){
      stroke(0);
      float t = map (sy, 0,height, 0.0,0.25); 
      float sx = 100 + 25.0 / tan ((t + percent)*TWO_PI); 
      point (sx+counter*10,sy); 
      }

    for (int sy=0; sy < height; sy+=4){
      stroke(255);
      float t = map (sy, 0,height, 0.0,0.25); 
      float sx = width/2 + 25.0 * tan ((t + percent)*TWO_PI); 
      point (sx+counter*10,sy); 
      }
      counter+=1;
      saveFrame("Gif-.png");
   }

  //----------------------
  // If we're recording, I include some visual feedback. 
  if (bRecording) {
    fill (255, 0, 0);
    textAlign (CENTER); 
    String percentDisplayString = nf(percent, 1, 3);
    text (percentDisplayString , cx, cy-15);
  }
}

Comments are closed.