Set animation valueFrom valueTo programmatically in Android animated-vector
Asked Answered
H

0

8

I created an animated-vector as below, and it is used to implement the curve morph animation from path1 to path2. I have other curve pathes like path3,path4, path5, and I need implement the morph animation from path1->path3, path1->path4, path2->path1, path2->path3..., there are lots of combination, therefore, I need set the "android:valueFrom" and "android:valueTo" programmatic ally, otherwise, I have to manually created lots of such animated-vector files. I didn't find any API in Android Animation package. What can I do for it? Are there any other solutions for it?

<?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>
Hahnert answered 11/7, 2017 at 9:40 Comment(1)
Any solution for this?Turnpike

© 2022 - 2024 — McMap. All rights reserved.