Exemple #1
0
 public void scrollTo(int x, int z, boolean animated, int duration) {
   if (!animated) {
     Point p = mapCoordsToOutside(new Point(x, z));
     int scrollX = p.getX(), scrollZ = p.getY();
     setScrollPosition(Orientation.HORIZONTAL, scrollX - (int) (getWidth() / 2));
     setScrollPosition(Orientation.VERTICAL, scrollZ - (int) (getHeight() / 2));
   } else {
     Point start = getCenterCoord();
     Point end = new Point(x, z);
     PropertyAnimation ani = new PropertyAnimation(this, "scrollpos");
     ani.setStartValue(start);
     ani.setEndValue(end);
     ani.setDuration(duration);
     ani.start();
   }
 }