The Handshake of the Lines

I connected my computer generated artwork with the potentiometer to change how lines are drawn in the circle.

//Circles and Lines_Nisala Saheed


class DrawLine {

  PVector point1;
  PVector point2;

  float angle;
  float angle2;
  float radius;

  float x;
  float y;

  float x2;
  float y2;



  DrawLine(float _angle, float _angle2, float _radius) {

    point1 = new PVector(x, y);
    point2 = new PVector(x2, y2);

    angle=_angle;
    angle2=_angle2;
    radius = _radius;
  }

  void update() {

    angle2 = angle * sin(modifier) * 4;

    x = center.x + cos(angle)*radius;
    y = center.y + sin(angle)*radius;


    x2 = center.x- cos(angle2)*radius;
    y2 = center.y- sin(angle2)*radius;

    angle += PI/120;
    angle2+=PI/90;
  }

  void display() {

    stroke(modifier, 220, 160);
    line(x, y, x2, y2);
  }
}



DrawLine myLine[];
PVector center;
float angle;
float angle2;
float radius;
int numLines = 15;
float change;
float increment;
float modifier = 0;

import processing.serial.*;

Serial myPort;


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

  printArray(Serial.list());
  String portname=Serial.list()[31];
  println(portname);
  myPort = new Serial(this, portname, 9600);

  center = new PVector (width/2, height/2); // we need to know the center of the cirlce that we are drawing.
  angle = 0;
  angle2 = 0;
  radius = 100;

  change = map (mouseX, 0, width, 0, 10);
  increment = TWO_PI/numLines;
  myLine = new DrawLine[numLines];

  for (int i=0; i<numLines; i++) {
    float ang = i*increment;//this is how much the angle increments by.
    myLine [i] = new DrawLine (ang, ang*sin(3)*4, radius);
  }

  //increase i as an increment for the number of lines, until it reaches the desired number of lines
}
void draw() {
  //background(50);
  noStroke();
  fill(20, 30); 
  rect(0, 0, width, height);

  //if you want to see the center
  //ellipse(center.x, center.y, 10, 10);
  //draw the lines

  //change = map (mouseX, 0, width, 1.5, 3);


  for (int i=0; i<numLines; i++) {
    myLine[i].display();

    map(modifier, 0, 1023/4, 2, 3);
    myLine[i].update();
  }
}

void serialEvent(Serial myPort) {
  modifier = myPort.read();
  myPort.write(0);
}


void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial.write(0);
}

void loop() {
  if(Serial.available()>0){
    int inByte=Serial.read();
    int sensor = analogRead(A0);
    delay(1);
    sensor/=4;
    Serial.write(sensor);
  }
}

 

 

For my final project, I am considering creating an audio-visualizer. Most of the complexity of this should lie in coding processing, but I would need a sound sensor that can detect various frequencies. If such a sensor is not available I could create a relationship between a particular visual and how loud a sound it, or where it is coming from. This could take form in a small object that listens to music, or a larger piece that requires an individual to move within a designated space to impact a visual.

On the note of coding.

I have come to develop a particular relationship to the idea of coding. I used to consider it purely ambiguous and inscrutable numbers and words that randomly create some beautiful thing. However, after taking this class, I consider it something that is not one and the same as numbers. I think of it as a regularized, replicateable process. When we first explored processing, I wanted to begin creating graphics and beautiful images using the coding platform, despite having access to illustrator. In my frustration at my lack of skill in creating images in the software, I came to think of medium, and which medium is appropriate for what work.

As such, I consider processing and the logical nature of code and computing as a medium by which express myself.

 

Leave a Reply