Google Maps v2上的透明圈动画没有正确设置动画 [英] Animated Transparent Circle on Google Maps v2 is NOT animating correctly

查看:44
本文介绍了Google Maps v2上的透明圈动画没有正确设置动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够为Android Google Maps v2上的基本圈子设置动画,但我想向前迈出一步. 我希望动画圈类似于Tinders动画圈,这有可能吗?

I was able to animate a basic circle on Android Google Maps v2, but I wanted to take it a step forward. I wanted the animated circle to be similar to Tinders animated circles, is that possible?

示例: http://jsfiddle.net/Y3r36/9/

现在,我得到了一个令人讨厌的动画,这是非常令人无法接受的.这是我的代码:

Right now, I am getting a fidgety animation that is very unacceptable. Here is my code:

public void onMapReady(GoogleMap map) {
        double latitude = 33.750587;
        double longitude = -84.4199173;

        LatLng latLng = new LatLng(latitude,longitude);

        map.moveCamera(CameraUpdateFactory.newLatLng(latLng));
        map.animateCamera(CameraUpdateFactory.zoomTo(13));
        map.addMarker(new MarkerOptions()
                .position(new LatLng(latitude, longitude))
                .title("Marker"));


        final Circle circle = mMap.addCircle(new CircleOptions()
                .center(new LatLng(latitude,longitude))
                .radius(50).fillColor(0x5500ff00).strokeWidth(0)
        );
        ValueAnimator valueAnimator = new ValueAnimator();
        valueAnimator.setRepeatCount(ValueAnimator.INFINITE);
        valueAnimator.setRepeatMode(ValueAnimator.RESTART);
        valueAnimator.setIntValues(0, 100);
        valueAnimator.setDuration(1000);
        valueAnimator.setEvaluator(new IntEvaluator());
        valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
        valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                float animatedFraction = valueAnimator.getAnimatedFraction();
                Log.e("", "" + animatedFraction);
                circle.setRadius(animatedFraction * 100);
            }
        });
        valueAnimator.start();

我愿意接受任何建议.谢谢

I'm open to any suggestions. Thank you

推荐答案

显然,如果正确使用,有两个github库可用于在标记上产生这种连锁反应:

Apparently there are two github libraries that can be used to create this ripple effect on markers, if used correctly:

https://github.com/skyfishjy/android-ripple-background

https://github.com/markushi/android-circlebutton

这篇关于Google Maps v2上的透明圈动画没有正确设置动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆