This bug has seriously ruined my week. I'm trying to create an interactive leaderboard and in it are three arrays: 1 with images and 2 with integers that I wrote as strings. I'm trying to make a keyPressed event that'll make the numbers change with the images representing the teams as they go up or down the ladder and I have a mousePressed event to execute a loop to revert the window back to its original state.
My problem is when I try to run the code the keyPressed event doesn't execute and only does so after I click on the mouse. Then the images move but the string array doesn't loop back with the first set of images. I have included the code below...I know it is lengthy and trust I have been refractoring and shortening as I go. Right now what I would like help with is making sure the keyPressed event executes first and the the positions1 string array reverts back to its original position when the loop executes.
I have included my code below and am working on a Macbook Pro OSX Processing 2.0b7.
I am working on a project in which I am trying to visualize a log of soccer teams moving up and down in the ranks as a year goes by.
I saved the images representing the teams into an array and called it in the draw function. Now I want to tween their movements using shapetween but I don't know where to initialize the x and y positions of the teams. If I try to initialize them globally I get this error message:
Cannot reference a field before it is defined
And when I try to initialize the x and y values locally it says they need to be initialized. My code is below and I am running Processing 2.0b7 on a Mac using OS X, and oh though it may not show I have added the shapetween library to the sketch:
I hope someone can help me here. I'm pretty much a noob trying to make an interactive graphic showing soccer teams moving up or down FIFA rankings. I loaded pictures I created outside of Processing to represent the teams and I want them to move based on a mouse click event.
My problem right now is that when I test the app it doesn't size according to the settings I put in. Most of the images get cut off. I tried frame.setResizable() and while I can manipulate the size of the window to a degree my images are still cut off.
Below is my code and I am working on Processing 2.0B7 on a Macbook Pro running on OS X:
//Setting up the images that will go into the sketch
I hope someone can help me with my problem. I'm trying to make a simple visualization to show how soccer teams either moved up or down in the FIFA rankings for 2012. To that I have created and loaded 17 images to my sketch which I want to move based on a button event. Below is my code:
//Setting up the images that will go into the sketch
I keep getting this error message: Badly formed character (expecting quote, got I). And below is the output in the console:
processing.app.SketchException: Badly formed character constant (expecting quote, got l) at processing.mode.java.preproc.PdePreprocessor.checkForUnterminatedMultilineComment(PdePreprocessor.java:478) at processing.mode.java.preproc.PdePreprocessor.write(PdePreprocessor.java:515) at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:270) at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:185) at processing.mode.java.JavaBuild.build(JavaBuild.java:144) at processing.mode.java.JavaBuild.build(JavaBuild.java:123) at processing.mode.java.JavaMode.handleRun(JavaMode.java:114) at processing.mode.java.JavaEditor$19.run(JavaEditor.java:474) at java.lang.Thread.run(Thread.java:680)
I'm using Processing 2.0B7 on a Macbook Pro running on OS X.
I am sort of a newbie with Processing but looking to do some cool things with it for my newsroom. I'm trying to build a tweet stream animation based on hashtags for teams. I got the code from this blog: blog.blprnt.com/blog/blprnt/updated-quick-tutorial-processing-twitter
Below is my code, with the code keys blocked out, and I keep getting "unexpected token: (" error at the cb.setOAuthConsumerKey line (line 12).
Can someone help?
//Build an ArrayList to hold all of the words that we get from the imported tweets
ArrayList<String> words = new ArrayList();
void setup() {
//Set the size of the stage and the backgroud to black.
size(550,550);
background(0);
smooth();
//Credentials
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setOAuthConsumerKey("xxxxxxxxxxxxx");
cb.setOAuthConsumerSecret("xxxxxxxxxxxx");
cb.setOAuthAccessToken("xxxxxxxxx-xxxxxxxxxxx");
cb.setOAuthAccessTokenSecret("xxxxxxxxxxxxxxx");
//Make the Twitter object and prepare the query
Twitter twitter = new TwitterFactory(cb.build()).getInstance();
Query query = new Query("#OrlandoPirates");
query.setRpp(100);
//Try making the query request.
try {
QueryResult result = twitter.search(query);
ArrayList tweets = (ArrayList) result.getTweets();
for (int i = 0; i < tweets.size(); i++) {
Tweet t = (Tweet) tweets.get(i);
String user = t.getFromUser();
String msg = t.getText();
Date d = t.getCreateAt();
println("Tweet by " + user + " at " + d + ": " + msg);
//Break the tweet into words
String[] input = msg.split(" ");
for (int j = 0; j < input.length; j++) {
//Put each word into the words ArrayList
words.add(input[j]);
}
};
}
catch (TwitterException te) {
println("Couldn't connect: " + te);
};
}
void draw() {
//Draw a faint black rectangle over what is currently on the stage so it fades over t
fill(0,1);
rect(0,0,width,height);
//Draw a word from the list of words that we've built
int i = (frameCount % words.size());
String word = words.get(i);
//Put it somewhere random on the stage, with a random size and colour
fill(255,random(50,150));
textSize(random(10,30));
text(word, random(width),random(height));
}