geftimov / android-pathview

Android view with both path from constructed path or from svg.
Apache License 2.0
2.91k stars 513 forks source link

Can't get Colors of the SVG? #2

Closed AruLNadhaN closed 9 years ago

AruLNadhaN commented 9 years ago

I am using a Colored Svg as source. It traces the path of the svg. But I need to color the svg after tracing the path.

Is there a way to do it?

geftimov commented 9 years ago

Hello AruLNadhaN,

You can try animating the object property and change the color after the animation is done. Here is an example:

            final ObjectAnimator anim = ObjectAnimator.ofFloat(pathView, "percentage", 0.0f, 1.0f);
            anim.setDuration(700);
            anim.setInterpolator(new LinearInterpolator());
            anim.addListener(new Animator.AnimatorListener() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    pathView.setPathColor(Color.GREEN);
                }
            });
            anim.start();
geftimov commented 9 years ago

@AruLNadhaN Do this answer your quesition ?

geftimov commented 9 years ago

@AruLNadhaN Now you can just use the pathAnimator like this.

pathView.getPathAnimator() .listenerEnd(new AnimationListenerEnd()) .start();