-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTwitterImageToy.pde
76 lines (46 loc) · 1.48 KB
/
TwitterImageToy.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
See the profile images of those who have most recently tweeted a hashtag.
You'll need to add the Twitter4J library to your Processing "libraries" folder.
https://github.com/yusuke/twitter4j/
*/
import twitter4j.util.*;
import twitter4j.*;
import twitter4j.management.*;
import twitter4j.api.*;
import twitter4j.conf.*;
import twitter4j.json.*;
import twitter4j.auth.*;
import java.util.*;
Twitter twitter;
String searchString = "#dhsi2015";
List<Status> tweets;
int currentTweet;
String user;
void setup() {
size(800, 600);
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setOAuthConsumerKey(""); // Register your App at Twitter, and use them here.
cb.setOAuthConsumerSecret(""); // Register your App at Twitter, and use them here.
cb.setOAuthAccessToken(""); // Register your App at Twitter, and use them here.
cb.setOAuthAccessTokenSecret(""); // Register your App at Twitter, and use them here.
TwitterFactory tf = new TwitterFactory(cb.build());
twitter = tf.getInstance();
getNewTweets();
currentTweet = 0;
thread("refreshTweets");
}
void draw() {
fill(0, 40);
rect(0, 0, width, height);
currentTweet = currentTweet + 1;
if (currentTweet >= tweets.size()) {
currentTweet = 0;
}
Status status = tweets.get(currentTweet);
User user = status.getUser();
String url = user.getProfileImageURL();
PImage img = loadImage(url);
fill(200);
image(img, random(width-75), random(height-75));
delay(250);
}