Chapter 32 Property Animation
Figure 32.2 Setting sun
You should see the sun move below the horizon.
Here is how it works: ObjectAnimator is a property animator. Instead of knowing specifically about
how to move a view around the screen, a property animator repeatedly calls property setter methods
with different values.
The following method call creates an ObjectAnimator:
ObjectAnimator.ofFloat(mSunView, "y", 0, 1)
When that ObjectAnimator is started, it will then repeatedly call mSunView.setY(float) with values
starting at 0 and moving up. Like this:
mSunView.setY(0);
mSunView.setY(0.02);
mSunView.setY(0.04);
mSunView.setY(0.06);
mSunView.setY(0.08);
... and so on, until it finally calls mSunView.setY(1). This process of finding values in between a
starting and ending point is called interpolation. Between each interpolated value, a little time will
pass, which makes it look like the view is moving.
View transformation properties
Property animators are great, but with them alone it would be impossible to animate a view as easily as
you just did. Modern Android property animation works in concert with transformation properties.
Your view has a local layout rect, which is the position and size it is assigned from the layout
process. You can move the view around after that by setting additional properties on the view, called
transformation properties. You have three properties to rotate the view (rotation, pivotX, and pivotY,