As computing becomes more ubiquitous in our objects, designers need to be more aware of how to design meaningful interactions into electronically enhanced objects. At the University of Washington, a class of junior Interaction Design majors is exploring this question. These pages chronicle their efforts.

Thursday, April 24, 2014

Mouse Pointer Input. Modified Processing Sample Sketch - Daniel Galan


//Mouse input of fading squares following mouse pointer with a delayed "ghost" repetition.


int num = 130; //was 60. now has created a sillhouette style delayed response
float mx[] = new float[num]; //mouse on x axis creates a new float(new shape in new place)
float my[] = new float[num];

void setup() {
  size(540, 360); // size of window in pixels
  noStroke();
  fill(50, 130, 220, 5); //was (255, 20). fill of shape and transparency from 0-255.
   
}

void draw() {
  background(255);  //changed to white; was (50)

  // Cycle through the array, using a different entry on each frame.
  // Using modulo (%) like this is faster than moving all the values over.
  int which = frameCount % num;
  mx[which] = mouseX;
  my[which] = mouseY;

  for (int i = 0; i < num; i++) {
    // which+1 is the smallest (the oldest in the array)
    int index = (which+20 + i) % num; // was which+1 now delayed response to create a "ghost" repetition
    rect(mx[index], my[index], i, i); //was ellipse()  
  }

}

No comments:

Post a Comment