Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Flow animation #73

Open
DineshNeupane opened this issue May 15, 2021 · 4 comments
Open

Flow animation #73

DineshNeupane opened this issue May 15, 2021 · 4 comments

Comments

@DineshNeupane
Copy link

HI tarek, thank you very much for this very useful library. I am trying to implement something like below: color flow animation, don't know how to.
flow_animation

@tarek360
Copy link
Owner

You could use, trimPathOffset() like below,

      RichPathAnimator
                .animate(yourPath)
                .trimPathOffset(0f, 1.0f)
                .start()

and don't fill yourPath it should have a strokeWidth and strokeColor, like this:

 <vector xmlns:android="http://schemas.android.com/apk/res/android"
     android:height="64dp"
     android:width="64dp"
     android:viewportHeight="600"
     android:viewportWidth="600" >
         <path
             android:name="yourPath"
             android:strokeColor="#ff0000"
             android:strokeWidth="10dp"
             android:pathData="M300,70 l 0,-70 70,70 0,0 -70,70z" />
 </vector>

Note: there is a limitation here where yourPath stroke is always fixed so you can't have a path thin at the beginning and thick at the end.

@DineshNeupane
Copy link
Author

Tried your sample but could not get it. I'm actually considering the whole fill area as a single path and stroke as another path. I could only get fade in animation while filling.

@DineshNeupane
Copy link
Author

Here is what I've achieved so far, just want to implement the animation like flow animation mentioned above.
https://user-images.githubusercontent.com/19649670/119294146-87c49380-bc73-11eb-8966-104e90f7605a.mp4

@tarek360
Copy link
Owner

Unfortunately, it's impossible to get exactly that flow animation you mentioned above by using RichPath but you could get a trimming path animation like the example I posted above.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants