Created
October 19, 2017 22:54
-
-
Save zamfi/27e5db9e915e1259ec184dc1eed645e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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