Ten Line

Ten_Line

My initial idea of ten lines was that the lines would move in a line according to the mouse movement and when the mouse stops moving the lines would spread out in circle and turn. However, I couldn’t figure out the way for the lines to follow the path that mouse had moved. So I changed my original idea of the ten lines following the path of mouse and just made the ten lines follow mouse similar to that of one line assignment.

 

float x;
float y;
float easing = 0.05;

void setup(){
    size(600, 600);
}

void draw(){
    background(0);
    stroke(255);
    follow();
}

void follow(){
    float followX = mouseX;
    float distanceX = followX - x;
    float followY = mouseY;
    float distanceY = followY - y;
  if(abs(distanceX)<=1 && abs(distanceY)<=1){
    noFill();
    float cx = mouseX;
    float cy = mouseY;
    int r = 40; 
    float t = millis()/4000.0f;

    for (int i = 1 ; i <= 10; i++) {         t = t + 120;         int x = (int)(cx + r * cos(t));         int y = (int)(cy + r * sin(t));         line(cx, cy, x, y);     }   }   else{     if(abs(distanceX) > 1) {
      x += distanceX * easing;
    }
    if(abs(distanceY) > 1) {
      y += distanceY * easing;
    }
    for (int i = 1; i<=10; i++){
       line(x-15+i*3, y-20, x-15+i*3, y+20);
    }
  }
}

IMG_20141001_145640

One Line

One_Line

 

In this assignment I was trying to make a line that waves when it touches the mouse. The line would be following the mouse but when the mouse moves quickly the line would need time to catch up with the mouse.

float n = 8;
float m = 0;
float x;
float y;
float easing = 0.05;

void setup() {
  size(500, 500);  
}

void draw() { 
  background(255);
  follow();
}

void follow(){
    float followX = mouseX;
    float distanceX = followX - x;
    float followY = mouseY;
    float distanceY = followY - y;
  if(abs(distanceX)<=1 && abs(distanceY)<=1){
    noFill();
    beginShape();
    for(int i=1; i<n; i++){         m = random(-20,20);         curveVertex(x + m, y + i * 40 / n );     }     endShape();   }   else{     if(abs(distanceX) > 1) {
      x += distanceX * easing;
    }
    if(abs(distanceY) > 1) {
      y += distanceY * easing;
    }
    line(x, y-20, x, y+20);
  }
}

IMG_20141001_145621

Thousand Lines: Circular Motion

thousandLines

I am intrigued by both the organic movement that can be created with circular motion and the oddly-curved shapes that can be drawn with lines, so I decided to combine the two. The overall motion is reminiscent of curtains flapping in a light breeze.  To meet the thousand line requirement, this sketch draws 600 white lines and overlays them with 400 black lines to create a mesh-like pattern.

//Miranda Jacoby
//EMS Interactivity Section A
//majacoby@andrew.cmu.edu
//Copyright Miranda Jacoby 2014

// Circular motion addapted from Heisei's code, 
// which can be found on OpenProcessing.org at 
// https://openprocessing.orgsketch/106191

//Variables for circular movement
int constant = 10;// anchor point
float angle = 0.05;// roational angle
int scalar = 150;// size of rotation
float speed = 0.05;// speed of rotation
  
void setup(){
size(600, 600);
strokeWeight(.5);
}
 
void draw(){
background(0);

angle = angle + speed;
float x = constant + sin(angle) * scalar;
float y = constant + cos(angle) * scalar;

for (int i = 0; i <= 100; i++) {
  stroke(255, 255, 255);// white lines
  //line(x, y, x + width + 100, y + height + 100);
//The exclusion of x from the second set of coordinates 
//creates the angled fan effect in the lines' position.
  line(y, x, y + (width/2) + 100, (height/2) + 100);
  y = y + 6;
  x = x + 6;
}

for (int i = 100; i <= 200; i++) {
  //line(x, y, x + width + 100, y + height + 100);
  line(y, x, y - (width/4) - 100, (height/4) - 100);
  y = y - 6;
  x = x - 6;
}

for (int i = 200; i <= 300; i++) {
//  stroke(200, 200, 250);
  //line(x, y, x + width + 100, y + height + 100);
  line(y - 10, x - 200, y + (width/2) + 100, (height/2) + 100);
  y = y + 6;
  x = x + 6;
}

for (int i = 300; i <= 400; i++) {
  //line(x, y, x + width + 100, y + height + 100);
  line(y - 10, x - 200, y - (width/4) - 100, (height/4) - 100);
  y = y - 6;
  x = x - 6;
}

for (int i = 400; i <= 500; i++) {
//  stroke(100, 150, 200);
  //line(x, y, x + width + 100, y + height + 100);
  line(y - 20, x - 400, y + (width/2) + 100, (height/2) + 100);
  y = y + 6;
  x = x + 6;
}

for (int i = 500; i <= 600; i++) {
  //line(x, y, x + width + 100, y + height + 100);
  line(y - 20, x - 400, y - (width/4) - 100, (height/4) - 100);
  y = y - 6;
  x = x - 6;
}
stroke(0); // black lines
for (int i = 600; i <= 700; i++) {
//  stroke(100, 150, 200);
  //line(x, y, x + width + 100, y + height + 100);
  line(y - 20, x - 600, y + (width/2) + 100, (height/2) + 100);
  y = y + 6;
  x = x + 6;
}

for (int i = 700; i <= 800; i++) {
  //line(x, y, x + width + 100, y + height + 100);
  line(y - 20, x - 600, y - (width/4) - 100, (height/4) - 100);
  y = y - 6;
  x = x - 6;
}
for (int i = 800; i <= 900; i++) {
//  stroke(100, 150, 200);
  //line(x, y, x + width + 100, y + height + 100);
  line(y - 20, x - 800, y + (width/2) + 100, (height/2) + 100);
  y = y + 6;
  x = x + 6;
}

for (int i = 900; i <= 1000; i++) {
  //line(x, y, x + width + 100, y + height + 100);
  line(y - 20, x - 800, y - (width/4) - 100, (height/4) - 100);
  y = y - 6;
  x = x - 6;
}
//for (int i = 200; i <= 300; i++) {
//  //line(x, y, x + width + 100, y + height + 100);
//  line(y, x, y - (width/3), (height/3));
//  y = y - 6;
//  x = x - 6;
//}

}


Ten Lines: Snappy Bird

tenLines2tenlinesconcept2Using the mouse’s x coordinate as input, I used my ten lines to draw a bird-like head that attempts to eat the mouse as it approaches the right side of the screen. The bird’s pupil also follows the mouse, but is constrained within the eye shape.

//Miranda Jacoby
//EMS Interactivity Section A
//majacoby@andrew.cmu.edu
//Copyright Miranda Jacoby 2014

//Implement offset to create spaces between lines

void setup() {
  size(400, 300);
}

void draw() {
  background(255); 
  strokeWeight(3); 
  
  //Center line
  line (200, 100, 200, 200); //Line 1

  float eyeX1 = map(mouseX, 0, 400, 140, 162);
  float eyeY1 = 150;
  float eyeX2 = map(mouseX, 0, 400, 140, 162);
  float eyeY2 = 160;

  float x1 = 50; 
  float y1 = 50;
  float x2 = 50; 
  float y2 = 150;
  
  
  float x3 = 350; 
  float y3 = 150; 
  float x4 = 350;
  float y4 = 50; 
  
  
//  float x5 = 350; 
//  float y5 = 350;
//  float x6 = 50; 
//  float y6 = 150;
//  
//  
//  float x7 = 350; 
//  float y7 = 150; 
//  float x8 = 350;
//  float y8 = 50; 
  
  //Top beak
  float beakLx1 = map(mouseX, 0,width, x1,x2); 
  float beakLy1 = map(mouseX, 0,width, y1,y2); 
  float beakRx1 = map(mouseX, 0,width, x3,x4); 
  float beakRy1 = map(mouseX, 0,width, y3,y4); 
  line (beakLx1, beakLy1,  beakRx1 , beakRy1 ); //Line 2
  
  //Inner top beak
  line(200, 150, beakRx1, beakRy1); //Line 3
  
  //Bottom beak
//  float beakLx2 = map(mouseX, 0,width, x5,x6); 
//  float beakLy2 = map(mouseX, 0,width, y5,y6); 
//  float beakRx2 = map(mouseX, 0,width, x7,x8); 
//  float beakRy2 = map(mouseX, 0,width, y7,y8); 
//  line (beakLx2, beakLy2,  beakRx2, beakRy2 );
  float beakLx2 = map(mouseX, 0,width, x1,x2); 
  float beakLy2 = map(mouseX, 0,width, y1 + 200 ,y2); 
  float beakRx2 = map(mouseX, 0,width, x3,x4); 
  float beakRy2 = map(mouseX, 0,width, y3, y4 + 200); 
  line (beakLx2, beakLy2,  beakRx2 , beakRy2 ); //Line 4
  
  //Inner bottom beak
  line(200, 150, beakRx2, beakRy2); //Line 5
  
  //Eye Shape
  line(125, 145, 175, 150); //Line 6
  line(175, 150, 150, 175); //Line 7
  line(150, 175, 125, 145); //Line 8
  
  //Pupil
  line(eyeX1, eyeY1, eyeX2, eyeY2); //Line 9
  
  //Back of head
  line(beakLx1, beakLy1, beakLx2, beakLy2); //Line 10
}

One Line: Inverse

oneLine(For some reason the program isn’t rendering properly on the blog, so here’s a .gif.)

onelineconcept2When interacting with this program, in what way do you move your mouse? Are its movement patterns curved, straight, or twisty? The coordinates of this sketch’s line are influenced by the mouse’s, creating a basic interaction.

If I were to build on this program, I’d add an element that creates a graphical representation of mouse’s path, making it easier to observe mouse movement patterns.

sketch.js code

Clock in Three Dimensions

clock3D

Time is commonly depicted in relativistic physics as the fourth dimension, and it makes sense that it is so. There really isn’t anything special about the way we define dimensions; dimensions are only models on how we as human beings perceive the world. The fourth dimension could be mapped to anything – not necessarily time. In fact, the first three dimensions do not necessarily need to be mapped to Cartesian x,y, and z coordinates – again this is only a commonly accepted notion of dimensionality as it applies to real world physical coordinate systems. So, I decided to alter this a bit and mapped the all three dimensions to time. The depth you see in the image above represents the hour, the height represents the minute, and the width represents the second. The result is a three dimensional representation of the 24-hour clock. I think the result is minimalist and geometrically interesting at the same time, and I am happy about the result.

clock3D

Thousand Line

thousandline

The final development to this little arcade jet-fighter simulator (with color s!). Since we can have 1000 lines during any one frame, I basically treated this as an arbitrarily large number and coded a simple space-invaders game, where all the graphics are being rendered with only lines. There is simple enemy AI and spawning, and the enemies’ left-right movement is controlled by a randomly spanned cosine wave against time. I also made a simple explosion system, in that whenever a jet is hit, a bunch of orange explosion particles fly out in random directions from the source of the jet that got hit. Also just for the heck of it, I also added a score counter on the bottom left of the screen, which resets every time the player gets hit by an enemy laser. Note that the control mechanic remained more or less identical from my one line demo, and that I didn’t have to employ single-frame “flickering” to conserve line count.

thousandline

Ten Line

tenlinemessage

So according to Golan, apparently my first idea for the ten line assignment was crap, and I agree.   Originally, I intended all three line pieces to be connected to each other and show developmental progress, with more lines leading to more complexity.  For my original ten line step, it was basically a cheap rehash of my one line piece.  So I decided to make a complete overhaul with the same sneaky “flickering” effect to provide an illusion of an order of magnitude more lines in the same scene than what the limitation provided for.  So in my new piece, I have that effect magnified by a power of ten to allow only ten lines to render at any one frame while appearing to hold many more.  An inspirational quote from Golan: “You got ten lines.  What are you gonna do?”

tenlines2

One Line

oneline

Trying to make something really cool with just one line was a real creative roadblock for me, so I thought about some ways to sneak past the limitation. Here is a simple space invader-esque shooter demo. Although it may look like there are multiple lines, there is actually only one line during any single frame. The way it works is that frames are shared between each of the lasers, such that every in every frame, a single different laser is rendered. The result is somewhat flickery, but it gets the job done and it emulates having multiple lines without actually having multiple lines at any instance.

oneline

 

Iterative

Iterative

I attempted to play around with some arbitrary math, rectangles and color and see what designs I could come up with. I started with the window-like rectangles and set their width and position according to iteration, but then I wondered, “Hey, why does it have to stop there?” So I also added iterative elements to the color as well as the alpha of the windows, and added more lines/rectangles to boot. This yellowy-blue-red rectangle structure was what I ended up with. Admittedly, I could have spent some more time fleshing out more details to make the overall piece better, but I’m happy about the result. The code is small and nothing too advanced is at play here.