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.

Monday, April 8, 2019

Large Vibrating Mass

Altered Code:

int rad = 200;        // Width of the shape
float xpos, ypos;    // Starting position of shape 

float xspeed = 5;  // Speed of the shape
float yspeed = 5;  // Speed of the shape

int xdirection = 5;  // Left or Right
int ydirection = 5;  // Top to Bottom


void setup()
{
  size(640, 360);
  noStroke();
  frameRate(30);
  ellipseMode(RADIUS);
  // Set the starting position of the shape
  xpos = width/2;
  ypos = height/2;
}

void draw()
{
  background(102);

  // Update the position of the shape
  xpos = xpos + ( xspeed * xdirection );
  ypos = ypos + ( yspeed * ydirection );

  // Test to see if the shape exceeds the boundaries of the screen
  // If it does, reverse its direction by multiplying by -1
  if (xpos > width-rad || xpos < rad) {
    xdirection *= -1;
  }
  if (ypos > height-rad || ypos < rad) {
    ydirection *= -1;
  }

  // Draw the shape
  ellipse(xpos, ypos, rad, rad);
}



In this experiment, as I am fairly new to code, I focused on trying to understand how it works at a basic level. I started by altering the size of the shape as that was a variable that I was comfortable varying without (hopefully) breaking the code. As I played with size, I then began to change the speed to see what would be the craziest thing I could do within the code. This lead to me making the shape extremely large and moving fast (for its size) to the point where it just looks like its vibrating side to side.

No comments:

Post a Comment