【问题标题】:Animate marker on Nutiteq 3D SDKNutiteq 3D SDK 上的动画标记
【发布时间】:2017-02-04 02:02:27
【问题描述】:

我正在尝试将标记从一个位置设置到另一个位置。为此,我使用 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

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

【问题讨论】:

  • 这段代码是做什么的,你希望它做什么?如果你能说出你的问题会更好:)
  • @JaakL 我正在尝试将标记从一个点移动到另一个点。我不想在更改位置时变得生涩。相反,它应该动画流畅。

标签: android nutiteq


【解决方案1】:

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

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

到线

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-18
    • 2013-01-29
    • 1970-01-01
    • 2017-07-17
    • 2014-03-13
    相关资源
    最近更新 更多