Uncategorized

This category contains 2 posts

Exercise B_week 1

This exercise will seek to examine the essence of Hornbake Plaza, specifically its transitory nature. As the video was shot on a cold day, rather than in the spring when the space is used as a gathering spot, almost all of the activity within the space was movement, both pedestrian through, and car along side. The final video will break Hornbake Plaza down into smaller sub-spaces, looking at how different occupants and activities within the plaza as a whole creates these divisions, and how each individual sub-space can be defined by its activities

little help

carl,

im trying to insert an image as the background.  I was able to do it with a color, however the color covered all of the squares and the block that you drag to manipulate “t”.  can you see if I am scripting this right for an image?  The image is one of abi’s textures from the first assignment.

 
 Handle[] handles;
int num;
int t;
int tpixels;
PFont fontA;
void setup()
{
  size(450, 500);
  num = 1;
  fontA = loadFont(”Helvetica-12.vlw”);
  textFont(fontA, 12);
  handles = new Handle[num];
  int hsize = 15;
  for(int i=0; i<num; i++) {
    handles[i] = new Handle(0, 475+i*15, 50-hsize/2, 15, handles);
    tpixels= 50-hsize/2;
    t=tpixels/4;
  }
 
 
}

void draw()
{
  background(255);
 
  for(int i=0; i<num; i++) {
    handles[i].update();
    handles[i].display();
  }
 
  fill(0);
  text(t, tpixels,460);
 
  for (int i=4; i<450; i+=9)   //edit the amount i increments to affect the y direction
  {
    for (int j=4; j<450; j+=9)  //edit the amount j increments to affect the x direction
    {
      noFill();
      PImage b;
      b = loadImage(kallushi_texture_1.jpg);
      background(b);
    // exercise 08 code starts here
 
  rect(i,j,t,t);
     
    ellipse(450,450,t,t);
    ellipse(0,0,t*2,t*2);
    ellipse(0,450,t*2,t*2);
    ellipse(450,0,t,t);
    //exercise 08 code ends here 
    }
  }
 
}

void mouseReleased()
{
  for(int i=0; i<num; i++) {
    handles[i].release();
  }
}

class Handle
{
  int x, y;
  int boxx, boxy;
  int length;
  int size;
  boolean over;
  boolean press;
  boolean locked = false;
  boolean otherslocked = false;
  Handle[] others;
 
  Handle(int ix, int iy, int il, int is, Handle[] o)
  {
    x = ix;
    y = iy;
    length = il;
  
    size = is;
    boxx = x+length - size/2;
    boxy = y - size/2;
    others = o;
   
  }
 
  void update()
  {
    boxx = x+length;
    boxy = y - size/2;
   
    for(int i=0; i<others.length; i++) {
      if(others[i].locked == true) {
        otherslocked = true;
        break;
      } else {
        otherslocked = false;
      } 
    }
   
    if(otherslocked == false) {
      over();
      press();
    }
   
    if(press) {
      length = lock(mouseX-size/2, 0, width-50);
      tpixels=lock(mouseX-size/2, 0, width-50);
      t=tpixels/4;
    }
  }
 
  void over()
  {
    if(overRect(boxx, boxy, size, size)) {
      over = true;
    } else {
      over = false;
    }
  }
 
  void press()
  {
    if(over && mousePressed || locked) {
      press = true;
      locked = true;
    } else {
      press = false;
    }
  }
 
  void release()
  {
    locked = false;
  }
 
  void display()
  {
   
    line(x, y, x+length, y);
    fill(255);
    stroke(0);
    rect(boxx, boxy, size, size);
    if(over || press) {
      line(boxx, boxy, boxx+size, boxy+size);
      line(boxx, boxy+size, boxx+size, boxy);
    }

  }
}

boolean overRect(int x, int y, int width, int height)
{
  if (mouseX >= x && mouseX <= x+width &&
      mouseY >= y && mouseY <= y+height) {
    return true;
  } else {
    return false;
  }
}

int lock(int val, int minv, int maxv)
{
  return  min(max(val, minv), maxv);
}