簡體   English   中英

Nutiteq 3D SDK上的動畫標記

[英]Animate marker on Nutiteq 3D SDK

我正在嘗試將標記從一個位置移動到另一個位置。 為此,我使用了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);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM