Skip to content

Instantly share code, notes, and snippets.

@zamfi
Created October 19, 2017 22:54
Show Gist options
  • Select an option

  • Save zamfi/27e5db9e915e1259ec184dc1eed645e1 to your computer and use it in GitHub Desktop.

Select an option

Save zamfi/27e5db9e915e1259ec184dc1eed645e1 to your computer and use it in GitHub Desktop.
int trumpFactor;
void setup() {
size(500, 500);
}
void draw() {
background(255);
translate(width/2, height/2);
fill(127, 0, 0);
noStroke();
ellipse(0, 0, trumpFactor * 10, trumpFactor * 10);
}
void mousePressed() {
trumpFactor = 0;
JSONObject data = loadJSONObject("https://www.buzzfeed.com/api/v2/feeds/index");
JSONArray stories = data.getJSONArray("big_stories");
for (int i = 0; i < stories.size(); i++) {
JSONObject story = stories.getJSONObject(i);
if (story.getString("title").contains("Trump")) {
trumpFactor += 1;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment