Set animation value from valueSo programmatically in Android animated vector

I created an animated vector as shown below and is used to implement the morphing animation of the curve from path 1 to path 2. I have other curves like path3, path4, path5 and I need to implement morph animation from path1-> path3, path1-> path4, path2-> path1, path2-> path3 ... there is a lot of combination, so, I need to set the programming union "android: valueFrom" and "android: valueTo", otherwise I will have to manually create many of these animated vector files. I didn't find an API in the Android Animation package. What can I do for this? Are there any other solutions for this?

<?xml version="1.0" encoding="utf-8"?>
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:aapt="http://schemas.android.com/aapt"
    android:drawable="@drawable/equalizer_gradient0" >
    <target android:name="v">
        <aapt:attr name="android:animation">
            <objectAnimator
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:duration="500"
                android:propertyName="pathData"
                android:valueFrom="@string/path1"
                android:valueTo="@string/path2"
                android:valueType="pathType"/>
        </aapt:attr>
    </target>
</animated-vector>

      

+3


source to share





All Articles