| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,14 +63,19 @@ void draw() { | |||
| 63 | 63 | bubbles = new Bubble[bubbleData.size()]; | |
| 64 | 64 | ||
| 65 | 65 | for (int i = 0; i < bubbleData.size(); i++) { | |
| 66 | + // Get each object in the array | ||
| 66 | 67 | JSONObject bubble = bubbleData.getObject(i); | |
| 68 | + // Get a position object | ||
| 67 | 69 | JSONObject position = bubble.getJSONObject("position"); | |
| 70 | + // Get x,y from position | ||
| 68 | 71 | int x = position.getInt("x"); | |
| 69 | 72 | int y = position.getInt("y"); | |
| 70 | - | ||
| 71 | - float diameter = (float)bubble.getDouble("diameter"); | ||
| 73 | + | ||
| 74 | + // Get diamter and label | ||
| 75 | + float diameter = bubble.getFloat("diameter"); | ||
| 72 | 76 | String label = bubble.getString("label"); | |
| 73 | 77 | ||
| 78 | + // Put object in array | ||
| 74 | 79 | bubbles[i] = new Bubble(x, y, diameter, label); | |
| 75 | 80 | } | |
| 76 | 81 | } | |
@@ -85,7 +90,7 @@ void draw() { | |||
| 85 | 90 | position.setInt("y", mouseY); | |
| 86 | 91 | ||
| 87 | 92 | // Add position to bubble | |
| 88 | - //newBubble.setJSONObject("position", position); | ||
| 93 | + newBubble.setJSONObject("position", position); | ||
| 89 | 94 | ||
| 90 | 95 | // Add diamater and label to bubble | |
| 91 | 96 | newBubble.setFloat("diameter", random(40, 80)); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments