SlideShare a Scribd company logo
Android
Animation
Android Training
By Khaled Anaqwa
Animation
 The Android framework provides two
animation systems:
 property animation (introduced in Android
3.0)
 view animation. (using XML)
 Both animation systems are viable
options, but the property animation
system, in general, is the preferred
method to use, because it is more flexible
and offers more features.
Property Animation
 Introduced in Android 3.0 (API level 11)
 lets you animate properties of any object,
including ones that are not rendered to
the screen.
 The system is extensible and lets you
animate properties of custom types as
well.
Property Animation
 Is a robust framework that allows you to
animate almost anything.
 You can define an animation to change
any object property over time, regardless
of whether it draws to the screen or not.
 it’s changes a property's (a field in an
object) value over a specified length of
time.
Property Animation
characteristics
 Duration (The default length is 300 ms)
 Time interpolation (function of the animation’s)
 Repeat count and behavior
 Animator sets (You can group animations into
logical sets that play together or sequentially or
after specified delays)
 Frame refresh delay (The default is set to
refresh every 10 ms)
Animator
 The Animator class provides the basic
structure for creating animations.
 You normally do not use this class directly
as it only provides minimal functionality
that must be extended to fully support
animating values.
Subclasses of Animator used
 ValueAnimator
This class provides a simple timing engine for running animations which
calculate animated values and set them on target objects.
 ObjectAnimator
 This subclass of ValueAnimator provides support for animating
properties on target objects.
 The constructors of this class take parameters to define the target
object that will be animated as well as the name of the property that
will be animated.
 it makes the process of animating values on target objects much
easier
 ObjectAnimator has a few more restrictions(Use ValueAnimator).
 AnimatorSet
 Provides a mechanism to group animations together so that they run
in relation to one another.
 You can set animations to play together, sequentially, or after a
specified delay
Animating with ValueAnimator
ValueAnimator animation= ValueAnimator.ofFloat(0f, 1f);
animation.setDuration(2000);
animation.addUpdateListener(new
ValueAnimator.AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator
animation) {
Float value = (Float)
animation.getAnimatedValue();
Float frac =
animation.getAnimatedFraction();
textView.setAlpha(value);}
});
Animating with
ObjectAnimator
ObjectAnimator anim =
ObjectAnimator.ofFloat(textview, "alpha", 0f, 1f);
anim.setDuration(1000);
anim.start();
AnimatorSet
 AnimatorSet set1= new AnimatorSet();
 Play()
 Before()
 With()
 After()
 Note : you can play set into another set
AnimatorSet set2= new AnimatorSet();
Set2.paly(set1).before(anim);
Declaring Animations in XML
<set android:ordering="sequentially">
<set>
<objectAnimator
android:propertyName="x"
android:duration="500"
android:valueTo="400"
android:valueType="intType"/>
<objectAnimator
android:propertyName="y"
android:duration="500"
android:valueTo="300"
android:valueType="intType"/>
</set>
<objectAnimator
android:propertyName="alpha"
android:duration="500"
android:valueTo="1f"/>
</set>
ValueAnimator - <animator>
ObjectAnimator - <objectAnimator>
AnimatorSet - <set>
Load Animation
AnimatorSet set = (AnimatorSet)
AnimatorInflater.loadAnimator(myContext,
R.anim.property_animator);
set.setTarget(myObject);
set.start();

More Related Content

PPTX
Android animations
PDF
[Android] Android Animation
PPTX
Android animation theory
ODP
Android App Development - 12 animations
PPTX
Basic Android Animation
PDF
Android animation
PDF
Introduction to Android Animations
PPTX
Animation in android
Android animations
[Android] Android Animation
Android animation theory
Android App Development - 12 animations
Basic Android Animation
Android animation
Introduction to Android Animations
Animation in android

What's hot (16)

PDF
Procedure of animation in 3 d autodesk maya tools &amp; techniques
PPTX
Animations & swift
KEY
Animation in iOS
PDF
Animate The Web With Ember.js - Jessica Jordan
PDF
Stop running from animations droidcon London
PDF
Google I/O 2013 - Android Graphics Performance
PDF
Core Animation
PPTX
Chap18 19
PPTX
TMD2063 | Digital Animation - Chapter 2
PPTX
Animation 2013 bis_taj
DOCX
Android animation and color state list resources-chapter 10
PPTX
ANIMATION SEQUENCE
PPTX
PPTX
PDF
iOS Core Animation
PPTX
Raster animation
Procedure of animation in 3 d autodesk maya tools &amp; techniques
Animations & swift
Animation in iOS
Animate The Web With Ember.js - Jessica Jordan
Stop running from animations droidcon London
Google I/O 2013 - Android Graphics Performance
Core Animation
Chap18 19
TMD2063 | Digital Animation - Chapter 2
Animation 2013 bis_taj
Android animation and color state list resources-chapter 10
ANIMATION SEQUENCE
iOS Core Animation
Raster animation
Ad

Viewers also liked (20)

PPTX
Android Transition
PDF
Android design and Custom views
PPTX
Android Animator
PPTX
ppt based on android technology with great animations
PPTX
Android AIDL Concept
PPTX
Android Service
PPTX
Material design for android
PDF
Android with dagger_2
PPTX
就職 創業 即戰力_20161214
PPTX
Android training (android style)
PPTX
Android Training (Broadcast Receiver)
PPTX
Android Training (Services)
PPTX
Android Training (android fundamental)
PPTX
Android Training (Touch)
PPTX
School Management System in Android
PDF
Android Material Design APIs/Tips
PPTX
Android Training (Notifications)
PPTX
Android Training (ScrollView , Horizontal ScrollView WebView)
PPTX
Material design - AndroidosDay 2015
PPT
Chapter 5 ms access-1
Android Transition
Android design and Custom views
Android Animator
ppt based on android technology with great animations
Android AIDL Concept
Android Service
Material design for android
Android with dagger_2
就職 創業 即戰力_20161214
Android training (android style)
Android Training (Broadcast Receiver)
Android Training (Services)
Android Training (android fundamental)
Android Training (Touch)
School Management System in Android
Android Material Design APIs/Tips
Android Training (Notifications)
Android Training (ScrollView , Horizontal ScrollView WebView)
Material design - AndroidosDay 2015
Chapter 5 ms access-1
Ad

Similar to Android Training (Animation) (20)

DOCX
Android animation in android-chapter17
PDF
The world of Android Animations
PPTX
Animation
PPTX
Android - Graphics Animation in Android
DOCX
Android view animation in android-chapter18
PPTX
Animate me, If you don't do it for me do it for Chet :)
PDF
Animações Fluídas no Android - DevFestPR 17
PDF
Enhancing UI/UX using Java animations
PPTX
Advance ui development and design
PPTX
Animations avec Compose : rendez vos apps chat-oyantes
PPTX
Android webinar class_4
PDF
How to implement react native animations using animated api
ODP
Day seven
PDF
animations
PDF
Breathing the life into the canvas
PDF
Graphicsand animations devoxx2010 (1)
PDF
3.2 ws WMS.pdf
PDF
Android 3.0 Portland Java User Group 2011-03-15
PDF
Abc2011 yagi
Android animation in android-chapter17
The world of Android Animations
Animation
Android - Graphics Animation in Android
Android view animation in android-chapter18
Animate me, If you don't do it for me do it for Chet :)
Animações Fluídas no Android - DevFestPR 17
Enhancing UI/UX using Java animations
Advance ui development and design
Animations avec Compose : rendez vos apps chat-oyantes
Android webinar class_4
How to implement react native animations using animated api
Day seven
animations
Breathing the life into the canvas
Graphicsand animations devoxx2010 (1)
3.2 ws WMS.pdf
Android 3.0 Portland Java User Group 2011-03-15
Abc2011 yagi

More from Khaled Anaqwa (9)

PPTX
Android Training (Storing & Shared Preferences)
PPTX
Android Training (Content Provider)
PPTX
Android Training (Storing data using SQLite)
PPTX
Android Training (Sensors)
PPTX
Android Training (Media)
PPTX
Android Training (AdapterView & Adapter)
PPTX
Android Training (Android UI)
PPTX
Android Training (Intro)
PPTX
Android Training (Java Review)
Android Training (Storing & Shared Preferences)
Android Training (Content Provider)
Android Training (Storing data using SQLite)
Android Training (Sensors)
Android Training (Media)
Android Training (AdapterView & Adapter)
Android Training (Android UI)
Android Training (Intro)
Android Training (Java Review)

Recently uploaded (20)

PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPT
Teaching material agriculture food technology
PPTX
Machine Learning_overview_presentation.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Approach and Philosophy of On baking technology
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
cuic standard and advanced reporting.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Getting Started with Data Integration: FME Form 101
PPTX
Big Data Technologies - Introduction.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Spectroscopy.pptx food analysis technology
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Teaching material agriculture food technology
Machine Learning_overview_presentation.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Advanced methodologies resolving dimensionality complications for autism neur...
NewMind AI Weekly Chronicles - August'25-Week II
Approach and Philosophy of On baking technology
Reach Out and Touch Someone: Haptics and Empathic Computing
Encapsulation_ Review paper, used for researhc scholars
Spectral efficient network and resource selection model in 5G networks
Unlocking AI with Model Context Protocol (MCP)
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
cuic standard and advanced reporting.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Getting Started with Data Integration: FME Form 101
Big Data Technologies - Introduction.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Spectroscopy.pptx food analysis technology

Android Training (Animation)

  • 2. Animation  The Android framework provides two animation systems:  property animation (introduced in Android 3.0)  view animation. (using XML)  Both animation systems are viable options, but the property animation system, in general, is the preferred method to use, because it is more flexible and offers more features.
  • 3. Property Animation  Introduced in Android 3.0 (API level 11)  lets you animate properties of any object, including ones that are not rendered to the screen.  The system is extensible and lets you animate properties of custom types as well.
  • 4. Property Animation  Is a robust framework that allows you to animate almost anything.  You can define an animation to change any object property over time, regardless of whether it draws to the screen or not.  it’s changes a property's (a field in an object) value over a specified length of time.
  • 5. Property Animation characteristics  Duration (The default length is 300 ms)  Time interpolation (function of the animation’s)  Repeat count and behavior  Animator sets (You can group animations into logical sets that play together or sequentially or after specified delays)  Frame refresh delay (The default is set to refresh every 10 ms)
  • 6. Animator  The Animator class provides the basic structure for creating animations.  You normally do not use this class directly as it only provides minimal functionality that must be extended to fully support animating values.
  • 7. Subclasses of Animator used  ValueAnimator This class provides a simple timing engine for running animations which calculate animated values and set them on target objects.  ObjectAnimator  This subclass of ValueAnimator provides support for animating properties on target objects.  The constructors of this class take parameters to define the target object that will be animated as well as the name of the property that will be animated.  it makes the process of animating values on target objects much easier  ObjectAnimator has a few more restrictions(Use ValueAnimator).  AnimatorSet  Provides a mechanism to group animations together so that they run in relation to one another.  You can set animations to play together, sequentially, or after a specified delay
  • 8. Animating with ValueAnimator ValueAnimator animation= ValueAnimator.ofFloat(0f, 1f); animation.setDuration(2000); animation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Float value = (Float) animation.getAnimatedValue(); Float frac = animation.getAnimatedFraction(); textView.setAlpha(value);} });
  • 9. Animating with ObjectAnimator ObjectAnimator anim = ObjectAnimator.ofFloat(textview, "alpha", 0f, 1f); anim.setDuration(1000); anim.start();
  • 10. AnimatorSet  AnimatorSet set1= new AnimatorSet();  Play()  Before()  With()  After()  Note : you can play set into another set AnimatorSet set2= new AnimatorSet(); Set2.paly(set1).before(anim);
  • 11. Declaring Animations in XML <set android:ordering="sequentially"> <set> <objectAnimator android:propertyName="x" android:duration="500" android:valueTo="400" android:valueType="intType"/> <objectAnimator android:propertyName="y" android:duration="500" android:valueTo="300" android:valueType="intType"/> </set> <objectAnimator android:propertyName="alpha" android:duration="500" android:valueTo="1f"/> </set> ValueAnimator - <animator> ObjectAnimator - <objectAnimator> AnimatorSet - <set>
  • 12. Load Animation AnimatorSet set = (AnimatorSet) AnimatorInflater.loadAnimator(myContext, R.anim.property_animator); set.setTarget(myObject); set.start();