File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -805,6 +805,56 @@ p5.prototype.httpPost = function () {
805
805
* @param {function } [errorCallback] function to be executed if
806
806
* there is an error, response is passed
807
807
* in as first argument
808
+ *
809
+ *
810
+ * @example
811
+ * <div>
812
+ * <code>
813
+ * // Examples use USGS Earthquake API:
814
+ * // https://earthquake.usgs.gov/fdsnws/event/1/#methods
815
+ *
816
+ * // displays an animation of all USGS earthquakes
817
+ * var earthquakes;
818
+ * var eqFeatureIndex = 0;
819
+ *
820
+ * function preload() {
821
+ * var url = 'https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson';
822
+ * httpDo(url,
823
+ * {
824
+ * method: 'GET',
825
+ * // Other Request options, like special headers for apis
826
+ * headers: { authorization: 'Bearer secretKey' }
827
+ * },
828
+ * function(res) {
829
+ * earthquakes = res;
830
+ * });
831
+ * }
832
+ *
833
+ * function draw() {
834
+ * // wait until the data is loaded
835
+ * if (!earthquakes || !earthquakes.features[eqFeatureIndex]) {
836
+ * return;
837
+ * }
838
+ * clear();
839
+ *
840
+ * var feature = earthquakes.features[eqFeatureIndex];
841
+ * var mag = feature.properties.mag;
842
+ * var rad = mag / 11 * ((width + height) / 2);
843
+ * fill(255, 0, 0, 100);
844
+ * ellipse(
845
+ * width / 2 + random(-2, 2),
846
+ * height / 2 + random(-2, 2),
847
+ * rad, rad
848
+ * );
849
+ *
850
+ * if (eqFeatureIndex >= earthquakes.features.length) {
851
+ * eqFeatureIndex = 0;
852
+ * } else {
853
+ * eqFeatureIndex += 1;
854
+ * }
855
+ * }
856
+ * </code>
857
+ * </div>
808
858
*/
809
859
810
860
/**
You can’t perform that action at this time.
0 commit comments