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 back of the card
     22     into view. The order of operations is described below:
     23 
     24     1. The back is immediately set to transparent.
     25     2. The invisible back rotates 90 degrees, from being fully flipped
     26        to being zero-width, fully perpendicular to the viewer, facing right.
     27        It is still invisible.
     28     3. The back is then made visible (this is half-way through the
     29        animation).
     30     4. The back rotates another 90 degrees, from zero-width, to
     31        100% of its normal width, facing the user.
     32 
     33     This is accomplished using the 3 child animators below, executed in
     34     parallel. Note that the last animator starts half-way into the animation.
     35 -->
     36 
     37 <set xmlns:android="http://schemas.android.com/apk/res/android">
     38     <!-- Before rotating, immediately set the alpha to 0. -->
     39     <objectAnimator
     40         android:valueFrom="1.0"
     41         android:valueTo="0.0"
     42         android:propertyName="alpha"
     43         android:duration="0" />
     44 
     45     <!-- Rotate. -->
     46     <objectAnimator
     47         android:valueFrom="-180"
     48         android:valueTo="0"
     49         android:propertyName="rotationY"
     50         android:interpolator="@android:interpolator/accelerate_decelerate"
     51         android:duration="@integer/card_flip_time_full" />
     52 
     53     <!-- Half-way through the rotation (see startOffset), set the alpha to 1. -->
     54     <objectAnimator
     55         android:valueFrom="0.0"
     56         android:valueTo="1.0"
     57         android:propertyName="alpha"
     58         android:startOffset="@integer/card_flip_time_half"
     59         android:duration="1" />
     60 </set>
     61