Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Property Animation

<objectAnimator
    android:propertyName="string"
    android:duration="int"
    android:valueFrom="float | int | color"
    android:valueTo="float | int | color"
    android:startOffset="int"
    android:repeatCount="int"
    android:repeatMode=["repeat" | "reverse"]
    android:valueType=["intType" | "floatType"]/>

Ok I am learning some Animation in android. I got it from Google Developer Docs two attributes that actually I am not able to understand are

android:propertyName="string"
android:valueType=["intType" | "floatType"]

Some of the values make sense "fade", "rotation", "alpha" But what about others like endYear, firstDayOfWeek

And I failed to find any detailed documentation about these or there may be chances that I am not understanding what various tutorials and Google Docs trying to convey..

**

My doubt is from where I can get all possible values of "propertyName" And what is "valueType" I mean what actually it do how actually it affect the animation

**

I am following this Tutorial and was trying to play with properties so as to have better understanding.

For say below attached screenshot shows so many possibilities for propertyName but I dont know how they make sense.

enter image description here

More Over propertyName accepts "x" and "y" as it values but they don't come in the window.

In case of ValueType if I change "floatType" to "intType" in the below mention snippet of the tutorial for wheel

<objectAnimator
    android:duration="3000"
        android:propertyName="rotation"
        android:repeatCount="infinite"
        android:repeatMode="reverse"
        android:valueTo="180"
        android:valueType="floatType" />

It stops animating..??????

Can Any one explain this issue or a source so as that I can figure it out..

This is what is explained in Google docs

NOTE:- I am trying animation for the first time not only with android but in my life too...

like image 311
DeltaCap019 Avatar asked Jun 25 '13 10:06

DeltaCap019


2 Answers

The propertyName parameter can be any property defined by the animation target's class. For instance, if the object you're animating offer a getFoo() and a setFoo() method, then there is a "foo" property you can animate.

A very simple example is View's getAlpha() and setAlpha() methods. They defined together the "alpha" property that you can animate to create fading effects

This also means you can create your own properties in your custom views. All you need to do is create two public methods: a getter and a setter.

You can look at this page for more information: http://developer.android.com/guide/topics/graphics/prop-animation.html#object-animator

like image 60
Romain Guy Avatar answered Nov 09 '22 11:11

Romain Guy


for honeycomb and above the available ones (according to this website) are:

  • translationX
  • translationY
  • rotation
  • rotationX
  • rotationY
  • scaleX
  • scaleY
  • pivotX
  • pivotY
  • x
  • y
  • alpha

as mentioned, you can also create your own properties, using get&set . i wonder if the new android versions have more properties built in.

you can also test them out in the API demos , in nineOldAndroids library , and on one of samsung samples.

like image 30
android developer Avatar answered Nov 09 '22 11:11

android developer