use of com.yandex.mapkit.map.PlacemarkMapObject in project react-native-yamap by volga-volga.
the class YamapMarker method animatedMoveTo.
public void animatedMoveTo(Point point, final float duration) {
PlacemarkMapObject placemark = (PlacemarkMapObject) this.getMapObject();
Point p = placemark.getGeometry();
final double startLat = p.getLatitude();
final double startLon = p.getLongitude();
final double deltaLat = point.getLatitude() - startLat;
final double deltaLon = point.getLongitude() - startLon;
ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1);
valueAnimator.setDuration((long) duration);
valueAnimator.setInterpolator(new LinearInterpolator());
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
try {
float v = animation.getAnimatedFraction();
moveAnimationLoop(startLat + v * deltaLat, startLon + v * deltaLon);
} catch (Exception ex) {
// I don't care atm..
}
}
});
valueAnimator.start();
}
use of com.yandex.mapkit.map.PlacemarkMapObject in project react-native-yamap by volga-volga.
the class YamapMarker method moveAnimationLoop.
public void moveAnimationLoop(double lat, double lon) {
PlacemarkMapObject placemark = (PlacemarkMapObject) this.getMapObject();
placemark.setGeometry(new Point(lat, lon));
}
use of com.yandex.mapkit.map.PlacemarkMapObject in project react-native-yamap by volga-volga.
the class YamapView method updateUserLocationIcon.
private void updateUserLocationIcon() {
if (userLocationView != null) {
PlacemarkMapObject pin = userLocationView.getPin();
PlacemarkMapObject arrow = userLocationView.getArrow();
if (userLocationBitmap != null) {
pin.setIcon(ImageProvider.fromBitmap(userLocationBitmap));
arrow.setIcon(ImageProvider.fromBitmap(userLocationBitmap));
}
CircleMapObject circle = userLocationView.getAccuracyCircle();
if (userLocationAccuracyFillColor != 0) {
circle.setFillColor(userLocationAccuracyFillColor);
}
if (userLocationAccuracyStrokeColor != 0) {
circle.setStrokeColor(userLocationAccuracyStrokeColor);
}
circle.setStrokeWidth(userLocationAccuracyStrokeWidth);
}
}
use of com.yandex.mapkit.map.PlacemarkMapObject in project react-native-yamap by volga-volga.
the class YamapMarker method rotateAnimationLoop.
public void rotateAnimationLoop(float delta) {
PlacemarkMapObject placemark = (PlacemarkMapObject) this.getMapObject();
placemark.setDirection(delta);
}
use of com.yandex.mapkit.map.PlacemarkMapObject in project react-native-yamap by volga-volga.
the class YamapMarker method animatedRotateTo.
public void animatedRotateTo(final float angle, float duration) {
PlacemarkMapObject placemark = (PlacemarkMapObject) this.getMapObject();
final float startDirection = placemark.getDirection();
final float delta = angle - placemark.getDirection();
ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1);
valueAnimator.setDuration((long) duration);
valueAnimator.setInterpolator(new LinearInterpolator());
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
try {
float v = animation.getAnimatedFraction();
rotateAnimationLoop(startDirection + v * delta);
} catch (Exception ex) {
// I don't care atm..
}
}
});
valueAnimator.start();
}
Aggregations