I am using property animation to rotate a fragment when it goes off screen. Following is my animator xml code:
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<objectAnimator
android:duration="500"
android:propertyName="rotationY"
android:valueFrom="-70"
android:valueTo="0" >
</objectAnimator>
<objectAnimator
android:duration="500"
android:propertyName="alpha"
android:valueFrom="0"
android:valueTo="1" >
</objectAnimator>
I want to rotate with the central point of the left edge as the pivot. How to do this?
The pivotX and pivotY is the central point of the animation. So for example if you want to do Zoom In animation you can use this <? xml version="1.0" encoding="utf-8"?> <
Tween animations are a specific type of animation related to rotation, sliding, and movement of an object. This article explains some common Tween animations. Now we move to the code part of this article. In this article, we will use a single Activity_main. xml.
These three types of animation fall into two categories: frame animations and tweened animations. Unsurprisingly, frame-base animations are a type of frame animation, whereas View- and Property-based animations are types of tweened animations.
You can add the:
android:transformPivotX and
android:transformPivotY
values to the object you want to animate in the layout XML where you created the object
(Eg. android:transformPivotX="0dp"
)
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With