如何在android的svg / bitmap路径中实现颜色填充波纹动画?

时间:2019-07-12 10:54:46

标签: java android kotlin android-animation

我正在开发一个儿童图画书android应用程序,其中用户将选择一个图像,该图像可以是svg或png图像,具有白色段,可以通过选择颜色然后点击白色段来填充颜色。我现在已经实现着色,我想给颜色填充波纹颜色填充动画,该动画应该从触摸点开始。

请提出如何实现波纹颜色填充动画的建议? android studio是否可能,还是我应该尝试统一? NDK? OpenGL?

我已经尝试过ValueAnimator,但是它不会产生连锁反应。

int colorFrom = paintHistoryModel.getPrevious_color();
        int colorTo = paintHistoryModel.getCurrent_color();
        ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
        colorAnimation.setDuration(250); // milliseconds
        colorAnimation.setInterpolator(new LinearInterpolator());
        colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

            @Override
            public void onAnimationUpdate(ValueAnimator animator) {
                //textView.setBackgroundColor((int) animator.getAnimatedValue());
                paint.setColor((int) animator.getAnimatedValue());
                canvas.drawPath(path, paint);
                sharpDrawable.getPicture().endRecording();
                vectorImageView.invalidate();
                vectorImageView.setLayerType(View.LAYER_TYPE_SOFTWARE, paint);
            }

        });
        colorAnimation.start();

我想实现以下应用程序的作用: https://play.google.com/store/apps/details?id=com.apalon.mandala.coloring.book

0 个答案:

没有答案