Android - objectAnimator xml alpha animation not working
Asked Answered
T

1

5

Using alpha as the propertyName of the objectAnimator does nothing at all. The objectAnimator is connected to a path inside the vector.

fading_animator.xml:

<set xmlns:android="http://schemas.android.com/apk/res/android">
    <objectAnimator
        android:duration="700"
        android:propertyName="alpha"
        android:valueFrom="1"
        android:valueTo="0"
        android:valueType="floatType"
        android:repeatCount="infinite"
        android:repeatMode="restart"/>
</set>

animated_vector.xml:

<animated-vector
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:drawable="@drawable/vector_drawable">

  <target
    android:name="pathTarget"
    android:animation="@animator/fading_animator"/>

</animated-vector>
Talyah answered 1/2, 2017 at 13:56 Comment(0)
T
14

When trying to animate the alpha of a path, you have to use either fillAlpha or strokeAlpha. Similarly, scaleX and scaleY will not work on a path but it will work on a group inside the vector.

Talyah answered 1/2, 2017 at 13:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.