/* * PROTEST GEGEN INETRNETSPERREN * VON LAIEN REGIERT * * with data from http://www.spreeblick.com/protest-gegen-internetsperren/ * * please load * http://www.spreeblick.com/demo/markers.xml * * Michael Schieben, 2009 * http://www.rockitbaby.de/ * http://www.twoantennas.com/ * * thanks to mlnmln, jhns, preciousforever * * libs used * - Modest Maps for Processing * http://www.tom-carden.co.uk/2008/02/18/modest-maps-vs-processing/ * place here code/modestmaps.jar * * feel free to play around and make something meaningful * feel free to play around and make something beautiful */ import processing.video.*; XMLElement markers; StaticMap map; int numMarkers = 0; PFont font; ArrayList visualizations; MovieMaker mm; void setup() { size(480, 640, P3D); noStroke(); // movie time? //mm = new MovieMaker(this, width, height, "drawing.mov", 30, MovieMaker.ANIMATION, MovieMaker.LOSSLESS); visualizations = new ArrayList(); font = loadFont("Verdana-63.vlw"); textFont(font, 10); markers = new XMLElement(this, "newmarkers.xml"); numMarkers = markers.getChildCount(); map = new StaticMap(this, new Microsoft.RoadProvider(), new Point2f(width, height), new Location(51.5, 10.0), 6); fill(0); rect(0, 0, width, height); } boolean allDots = false; void draw() { background(0); lights(); txt(); pushMatrix(); fly(); //chrome(); addDot(); addDot(); for (int i = 0; i < visualizations.size(); i++) { pushMatrix(); Vis vis = (Vis) visualizations.get(i); vis.draw(); popMatrix(); } popMatrix(); // if you want to make a video //mm.addFrame(); } void chrome() { fill(72, 246, 230); rect(0, 0, width, 16); } String currentName = ""; void txt() { fill(72, 246, 230); textAlign(LEFT); text(currentName, 10, 4, 200, 10); textAlign(RIGHT); text(str(dotsAdded), width - 100, 4, 95, 12); } float xDegStart = 60; float xDegEnd = 0; float sclStart = 0.2; float sclEnd = 0.9; int flyLen = 2000; void fly() { float scl = sclEnd; float xDeg = xDegEnd; if (frameCount < flyLen) { scl = map(frameCount, 0, flyLen, sclStart, sclEnd); xDeg = map(frameCount, 0, flyLen, xDegStart, xDegEnd); } rotateX(radians(xDeg)); translate(width / 2 - width * scl / 2, height / 2 - height * scl / 2); scale(scl); } int dotsAdded = 0; void addDot() { if (dotsAdded < numMarkers) { visualizations.add(new Vis(markers.getChild(dotsAdded))); dotsAdded++; } else { allDots = true; currentName = "and still counting, please visit spreeblick"; } } int visLen = 10; int startOpacity = 100; int endOpacity = 60; class Vis { XMLElement marker; Point2f p; int step = 0; String name = ""; Vis(XMLElement marker) { this.marker = marker; float lat = marker.getFloatAttribute("lat"); float lng = marker.getFloatAttribute("lng"); this.name = marker.getStringAttribute("name"); this.p = map.locationPoint2f(new Location(lat, lng)); currentName = this.name; } void draw() { fill(72, 246, 230, map(this.step, 0, visLen, startOpacity, endOpacity)); translate(this.p.x, this.p.y, map(this.step, 0, visLen, 50, 0)); //box(10, 10, 4); ellipse(0,0,4,4); if (this.step == 9) { fill(180, 255, 255); ellipse(0,0,8,8); } if (this.step < 10) { this.step++; } } void txt() { fill(72, 246, 230); textAlign(LEFT); text(this.name, 10, 4, 200, 10); } } void keyPressed() { if (key == ' ') { mm.finish(); // Finish the movie if space bar is pressed! } }