We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Changing Location Data
Page Index Toggle Pages: 1
Changing Location Data (Read 1478 times)
Changing Location Data
Apr 24th, 2010, 2:05pm
 
I'm working on something where I'm pulling information from a spread sheet. The idea of it is to have 2 states, one plotting information in linear fashion and on a click the state changes and all that information is then plotted onto a map. So the x and y location of the ellipse changes. I'm trying to get a transition effect from graph to map. I was wondering if anyone has any examples. I'm new with using classes and I'm having difficulty getting mine up and running. This is what I have so far for testing.

Code:
Transition t1 = new Transition (10,10,310,310);
PVector plot, mPlot;

void setup(){
size (400,400);
}
void draw (){
t1.update();
}

class Transition {
float x1,y1,x2,y2;
Transition (PVector plot, PVector mPlot){
plot = new PVector (x1,y1);
mPlot = new PVector (x2,y2);

}

void update () {
ellipse (plot.x1,plot.x2,5,5);
}
}
Re: Changing Location Data
Reply #1 - Apr 25th, 2010, 12:29am
 
Do you have an effect in mind that you would like to achieve. Its rather open ended the way you ask.  Monkeys could drop from the top of the window and use a steam roller or maybe you could use a nice cross fade.
Re: Changing Location Data
Reply #2 - Apr 25th, 2010, 12:48am
 
Moving things all up in here mid post  Tongue I couldn't figure out why I couldn't reply there.

It seems that your data has a static state should you don't even need to have a running loop. Basically you would have view style one for example your graph that would draw it self at the start of the program as say a graph and then have the program re render itself to reflect the state change to a map. The logic would be something like.

-----------------------------------------------------------------------
draw(){
if(map){
render your ellipses;
noloop;  #this will stop the program from re drawing
}

if (graph){
render you graph bars;
noloop;
}
}

mouseClicked(){
if (mouseX==graphButtonX  && mouseY==graphButtonY){#check to see if button is clicked
graph==true; #set the graph to draw
redraw(); #run your draw function again to update changes
}

if (mouseX==mapButtonX  && mouseY==mapButtonY){
map==true; #set the map to draw
redraw(); #run your draw function again to update changes
}

}

--------------------------------------------------------------------------

your classes should reflect the handling and parsing of your input for that some silly guy wrote this book. I read it when I started,  ok I skimmed it but it was a solid skim. Its  something that is worth buying ...........Can you believe those terrible people who Just pirate books. (most people can't even give proper credit)

http://www.google.com/products/catalog?q=ben+fry+visualizing+data&oe=utf-8&clien...
Re: Changing Location Data
Reply #3 - Apr 25th, 2010, 9:59am
 
It's going to be a point data graph. The ellipses will be drawn one by one when the program starts. I've got that down for the map part. What I want to do is to have it start off in the graph portion. Then when the you click a button, the points on the graph is translated into a new position on the map in an animation type of manner.
Re: Changing Location Data
Reply #4 - Apr 25th, 2010, 10:58pm
 
Ill write a quick example that may help you tonight.
Re: Changing Location Data
Reply #5 - Apr 26th, 2010, 4:04am
 
http://openprocessing.org/visuals/?visualID=9177
Re: Changing Location Data
Reply #6 - Apr 26th, 2010, 7:40am
 
Thanks so much for the help. I'll implement this once I fix another issue. :/
Re: Changing Location Data
Reply #7 - Apr 26th, 2010, 7:49am
 
Another question. Does it have to be stored in the globals? I'm calling all my numbers from within the draw and they're an array.
Re: Changing Location Data
Reply #8 - Apr 26th, 2010, 2:11pm
 
You are going to wan't to make it into a function then pass the array to the function with a for loop.


int[] data = data[10];

for(int i=0,i<data.length,i++){

animationfunction(data[i]);

}
Page Index Toggle Pages: 1