Wednesday, 17 February 2021

Rotating color change, something like the Edge lighting Android

Hi I am trying to animate a rotating colour change around the border of my background something like the one shown in this link: https://www.youtube.com/watch?v=hmxA1qvZlxs

Have been searching for clues for a long time but have yet to find anything useful.

I am using ValueAnimator for the border color transition but am at a lost for making it 'spin' or 'rotate' as in the video. My Code as Follow:

ValueAnimator anim = new ValueAnimator();
        anim.setIntValues(Color.parseColor("#FFFFFF"), Color.parseColor("#FFFF0000"));
        anim.setEvaluator(new ArgbEvaluator());
        anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                bgShape.setStroke(10, (Integer)valueAnimator.getAnimatedValue());
            }
        });

        anim.setDuration(10000);
        anim.setRepeatCount(1);
        anim.setInterpolator(new CycleInterpolator(10));
        anim.setRepeatMode(ValueAnimator.REVERSE);
        anim.start();

Anyone with ideas or work around this problem that could point me in the right direction?

Any help would be greatly appreciated.



from Rotating color change, something like the Edge lighting Android

No comments:

Post a Comment