gpt4 book ai didi

android - Nutiteq 3D SDK 上的动画标记

转载 作者:行者123 更新时间:2023-11-30 01:49:48 25 4
gpt4 key购买 nike

我正在尝试将标记从一个位置动画化到另一个位置。为此,我使用了 nutiteq 示例代码中的以下代码。

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();

https://github.com/nutiteq/hellomap3d/wiki/Animated-marker

请告诉我上面的代码有什么问题?

最佳答案

您正在使用适用于 SDK 2.x 的代码段。您也可以将它用于 SDK 3.x,但您需要更改以下行

PropertyValuesHolder markerLocationPVHolder = PropertyValuesHolder.ofKeyframe("mapPos", markerLocationKeyframes);

到线

PropertyValuesHolder markerLocationPVHolder = PropertyValuesHolder.ofKeyframe("pos", markerLocationKeyframes);

关于android - Nutiteq 3D SDK 上的动画标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33237458/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com