Permalink
Browse files

Updated animation (with external Ani library) to better show animation

features.
  • Loading branch information...
1 parent 56525d9 commit 99de13b4e42fc2a0654391be189076228b1dda44 @tillnagel committed Jan 15, 2014
@@ -4,15 +4,14 @@
import de.fhpotsdam.unfolding.UnfoldingMap;
import de.fhpotsdam.unfolding.geo.Location;
import de.fhpotsdam.unfolding.providers.Microsoft;
-import de.fhpotsdam.unfolding.utils.MapUtils;
import de.looksgood.ani.Ani;
/**
* Custom map animation with easing functions. Click anywhere to smoothly pan there. Press 'z' or 'Z' to zoom in and out
* smoothly.
*
* Demonstrates how to create own animations, instead of the built-in tweening functionality. In this example, the
- * external Ani library is used.
+ * external Ani library is used.
*/
public class AnimationWithAniLibApp extends PApplet {
@@ -25,11 +24,10 @@
float targetZoom = currentZoom;
public void setup() {
- size(1200, 600);
+ size(1200, 600, P2D);
map = new UnfoldingMap(this, new Microsoft.AerialProvider());
map.zoomAndPanTo(location, (int) currentZoom);
- MapUtils.createDefaultEventDispatcher(this, map);
Ani.init(this);
}
@@ -54,16 +52,15 @@ public void keyPressed() {
if (key == 'Z') {
targetZoom--;
}
+ Ani.to(this, 4.5f, "currentZoom", targetZoom, Ani.ELASTIC_OUT);
}
- Ani.to(this, 1.5f, "currentZoom", targetZoom, Ani.EXPO_OUT);
-
}
public void mouseReleased() {
Location targetLocation = map.getLocation(mouseX, mouseY);
- Ani.to(this, 1.5f, "lat", targetLocation.getLat(), Ani.EXPO_OUT);
- Ani.to(this, 1.5f, "lon", targetLocation.getLon(), Ani.EXPO_OUT);
+ Ani.to(this, 1.5f, "lat", targetLocation.getLat(), Ani.ELASTIC_OUT);
+ Ani.to(this, 1.5f, "lon", targetLocation.getLon(), Ani.ELASTIC_OUT);
}
}

0 comments on commit 99de13b

Please sign in to comment.