20 Şubat 2018 Salı

Android Dersleri 60 - XML kullanarak Android animasyonları uygulamak ve geliştirmek

Kaynaklar :
https://developer.android.com/guide/topics/resources/animation-resource.html
https://developer.android.com/reference/android/view/animation/Animation.html
https://developer.android.com/guide/topics/resources/animation-resource.html#Interpolators
http://www.androidhive.info/2013/06/android-working-with-xml-animations/

<alpha> kullanımı, fade-in ve fade-out animasyonları, AlphaAnimation class'ı

<alpha> :A fade-in or fade-out animation. Represents an AlphaAnimation.
attributes of <alpha> :android:fromAlpha    Float. Starting opacity offset, where 0.0 is transparent and 1.0 is opaque.android:toAlpha    Float. Ending opacity offset, where 0.0 is transparent and 1.0 is opaque.For more attributes supported by <alpha>, see the Animation class reference (of which, all XML attributes are inherrited by this element).AlphaAnimation class'Inın direct parent class'I Animation class'ıdır.

<set> : A container that holds other animation elements (<alpha>, <scale>, <translate>, <rotate>) or other <set> elements. Represents an AnimationSet.

Interpolator nedir?

An interpolator is an animation modifier defined in XML that affects the rate of change in an animation. This allows your existing animation effects to be accelerated, decelerated, repeated, bounced, etc.
An interpolator is applied to an animation element with the android:interpolator attribute, the value of which is a reference to an interpolator resource.
All interpolators available in Android are subclasses of the Interpolator class. For each interpolator class, Android includes a public resource you can reference in order to apply the interpolator to an animation using the android:interpolator attribute. The following table specifies the resource to use for each interpolator:
Interpolator classResource ID
AccelerateDecelerateInterpolator@android:anim/accelerate_decelerate_interpolator
AccelerateInterpolator@android:anim/accelerate_interpolator
AnticipateInterpolator@android:anim/anticipate_interpolator
AnticipateOvershootInterpolator@android:anim/anticipate_overshoot_interpolator
BounceInterpolator@android:anim/bounce_interpolator
CycleInterpolator@android:anim/cycle_interpolator
DecelerateInterpolator@android:anim/decelerate_interpolator
LinearInterpolator@android:anim/linear_interpolator
OvershootInterpolator@android:anim/overshoot_interpolator
Here's how you can apply one of these with the android:interpolator attribute:
<set android:interpolator="@android:anim/accelerate_interpolator">
    ...</set>

Hiç yorum yok:

Yorum Gönder