This is a very literal interpretation of my post from last week where I have an object that can interact with the people in the space depending upon what the time is between classes. The movie itself proves to be rather boring and pushing it forward I would like to try and make these objects actually define the space and how people can interact within it, as opposed to my current idea where it is simply an object within the space. If anyone has any ideas, similar or otherwise please let me know.
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);
}
For this project I looked at the electoral map from RealClearPolitics.com (more specifically the “Toss Up” states) and chose to relate them to when the presidential candidates were on tour there over the past several months. Each of the “skins” (one rendered, the other in wire frame), reflect an abstracted map of the United States. Portions of the map are raised according to how often each candidate visited the “Toss Up” state over the past several months. The colored dots throughout the map relate to the time line atop the image, the darker the dot, the more recent the visit. The three tallest parts of the map relate to a trend I saw while looking at each candidates tour schedules. Barack Obama seemed to have spent a large majority of his time in Iowa while, John McCain seemed to split alot of his time between Florida and Arizona.