This will probably need to be done in another context. Contenders are iframe or Worker. While both approaches require some hoop jumping, the Worker seems more inline with what we're trying to do.
here's how to duplicate undesired behavior
first populate the textbox with:
var c = cube(10);
var pos = 0;
setInterval(function() {
display(c, c.translate(pos++, 0, 0))
}, 1000);
then paste over it with:
var request = require('hyperquest')
var baseUrl = 'http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/'
var url = baseUrl + 'all_day.geojson'
request.get(url, function(e, r) {
r.on('data', function(d) {
var o = JSON.parse(d);
var spheres = [];
var magnifier = 1.0;
o.features.forEach(function(feature) {
if (!feature.properties.mag) { return; }
var coords = feature.geometry.coordinates;
spheres.push(
cube(feature.properties.mag * magnifier)
.translate(coords[0], coords[1], coords[2])
);
});
display(spheres);
});
});
This will probably need to be done in another context. Contenders are iframe or
Worker
. While both approaches require some hoop jumping, theWorker
seems more inline with what we're trying to do.here's how to duplicate undesired behavior
first populate the textbox with:
then paste over it with:
results in: