Android 在Nutiteq 3D SDK上设置标记动画
我正在尝试将标记从一个位置设置为另一个位置。为此,我使用nutiteq示例代码中的以下代码Android 在Nutiteq 3D SDK上设置标记动画,android,nutiteq,Android,Nutiteq,我正在尝试将标记从一个位置设置为另一个位置。为此,我使用nutiteq示例代码中的以下代码 MapPos markerLocation0 = baseProjection.fromWgs84(currentBlueDotPostion); MapPos markerLocation1 = baseProjection.fromWgs84(toPosition); Keyframe[] markerLocationKeyframes = new Keyframe[] { Keyframe.
MapPos markerLocation0 = baseProjection.fromWgs84(currentBlueDotPostion);
MapPos markerLocation1 = baseProjection.fromWgs84(toPosition);
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("mapPos", 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.getY() + (pos1.getY() - pos0.getY()) * fraction);
}
});
final ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(userPostionMarker, markerLocationPVHolder);
animator.setDuration(2000); // duration 2000ms
// Make it to bounce
animator.setInterpolator(new AccelerateInterpolator());
animator.start();
请告诉我上面的代码有什么问题?您使用的是SDK 2.x的代码段。您也可以将其用于SDK 3.x,但需要更改以下行
PropertyValuesHolder markerLocationPVHolder = PropertyValuesHolder.ofKeyframe("mapPos", markerLocationKeyframes);
排队
PropertyValuesHolder markerLocationPVHolder = PropertyValuesHolder.ofKeyframe("pos", markerLocationKeyframes);
这个代码做什么,你希望它做什么?如果你能告诉我你的问题是什么,那就更好了:)@JaakL我正在尝试将标记从一个点移动到另一个点。。我不想在改变位置时感到不安。相反,它应该平滑地设置动画。