Skip to content

Commit

Permalink
Updated animation (with external Ani library) to better show animation
Browse files Browse the repository at this point in the history
features.
  • Loading branch information
tillnagel committed Jan 15, 2014
1 parent 56525d9 commit 99de13b
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -25,11 +24,10 @@ public class AnimationWithAniLibApp extends PApplet {
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);
}
Expand All @@ -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.