public void animaCarro(NMLModel car){
// Define start and end keyframes
MapPos markerLocation0 = mapView.getOptions().getBaseProjection().fromWgs84(new MapPos(13.38933, 52.51704));
MapPos markerLocation1 = mapView.getOptions().getBaseProjection().fromWgs84(new MapPos(-82.141900, 23.1101));
Keyframe[] markerLocationKeyframes = new Keyframe[] {
Keyframe.ofObject(0.0f, markerLocation0),
Keyframe.ofObject(1.0f, markerLocation1)
};
// Create property values holder for "mapPos" property and set custom evaluator for MapPos type
PropertyValuesHolder markerLocationPVHolder = PropertyValuesHolder.ofKeyframe("pos", markerLocationKeyframes);
markerLocationPVHolder.setEvaluator(new TypeEvaluator() {
public Object evaluate(float fraction, Object startValue, Object endValue) {
MapPos pos0 = (MapPos) startValue;
MapPos pos1 = (MapPos) endValue;
return new MapPos(pos0.getX() + (pos1.getX() - pos0.getX()) * fraction, pos0.getX() + (pos1.getY() - pos0.getY()) * fraction);
}
});
// Create object animator for the marker using marker PVH and start the animation
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(car, markerLocationPVHolder);
animator.setDuration(10000); // duration 10s
// Make it to bounce
animator.setInterpolator(new AccelerateInterpolator());
animator.start();
}