Home | History | Annotate | Download | only in animator
      1 <!--
      2   Copyright 2012 The Android Open Source Project
      3 
      4   Licensed under the Apache License, Version 2.0 (the "License");
      5   you may not use this file except in compliance with the License.
      6   You may obtain a copy of the License at
      7 
      8       http://www.apache.org/licenses/LICENSE-2.0
      9 
     10   Unless required by applicable law or agreed to in writing, software
     11   distributed under the License is distributed on an "AS IS" BASIS,
     12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13   See the License for the specific language governing permissions and
     14   limitations under the License.
     15   -->
     16 
     17 <!--
     18     This object animator is used as a custom fragment transition. See
     19     FragmentTransaction.setCustomAnimation for more details.
     20 
     21     The overall effect of this animator is to rotate the front of the card
     22     out of view. The order of operations is described below:
     23 
     24     1. The front rotates 90 degrees, from facing the user to being
     25        zero-width, fully perpendicular to the viewer, facing left.
     26     2. The front is then made invisible (this is half-way through the
     27        animation).
     28     3. The front rotates another 90 degrees, from zero-width, to
     29        100% of its normal width, but facing away from the user and
     30        still invisible.
     31 
     32     This is accomplished using the 2 child animators below, executed in
     33     parallel. Note that the last animator starts half-way into the animation.
     34 -->
     35 
     36 <set xmlns:android="http://schemas.android.com/apk/res/android">
     37     <!-- Rotate. -->
     38     <objectAnimator
     39         android:valueFrom="0"
     40         android:valueTo="180"
     41         android:propertyName="rotationY"
     42         android:interpolator="@android:interpolator/accelerate_decelerate"
     43         android:duration="@integer/card_flip_time_full" />
     44 
     45     <!-- Half-way through the rotation (see startOffset), set the alpha to 0. -->
     46     <objectAnimator
     47         android:valueFrom="1.0"
     48         android:valueTo="0.0"
     49         android:propertyName="alpha"
     50         android:startOffset="@integer/card_flip_time_half"
     51         android:duration="1" />
     52 </set>
     53