SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Android Programming




     Lesson 13

Android Animation
    NGUYEN The Linh
Android Programming


Contents


       1   Property Animation

       2   Drawable Animation

       3   View Animation




                         2
Android Programming


Android Animation




            Property Animation




                    3
Android Programming


Property Animation

 Animating with ValueAnimator
    The ValueAnimator class lets you animate values of some type
     for the duration of an animation by specifying a set of int, float, or
     color values to animate through. You obtain a ValueAnimator by
     calling one of its factory methods: ofInt(), ofFloat(), or ofObject().
     For example:




                                   4
Android Programming


Property Animation

 Animating with ValueAnimator
    The previous code snippets, however, has no real effect on an
     object, because the ValueAnimator does not operate on objects
     or properties directly.

    You do this by defining listeners in the ValueAnimator to
     appropriately handle important events during the animation's
     lifespan, such as frame updates.




                                 5
Android Programming


Property Animation

 Animating with ValueAnimator
    When implementing the listeners, you can obtain the calculated
     value for that specific frame refresh by calling
     getAnimatedValue()

    Animator.AnimatorListener
       • onAnimationStart() - Called when the animation starts.

       • onAnimationEnd() - Called when the animation ends.

       • onAnimationRepeat() - Called when the animation repeats itself.

                                      6
Android Programming


Property Animation

 Animating with ValueAnimator
    Animator.AnimatorListener
     • onAnimationCancel() - Called when the animation is canceled. A cancelled
       animation also calls onAnimationEnd(), regardless of how they were ended.


   ValueAnimator.AnimatorUpdateListener
     • onAnimationUpdate() - called on every frame of the animation.




                                    7
Android Programming


Property Animation

 Animating with ObjectAnimator
    The ObjectAnimator is a subclass of
     he ValueAnimator (discussed in the previous section) and
     combines the timing engine and value computation
     of ValueAnimator with the ability to animate a named property of
     a target object.




                                 8
Android Programming


Property Animation

 Choreographing Multiple Animations with AnimatorSet
    In many cases, you want to play an animation that depends on
     when another animation starts or finishes.

    The Android system lets you bundle animations together into
     an AnimatorSet, so that you can specify whether to start
     animations simultaneously, sequentially, or after a specified delay.

    You can also nest AnimatorSet objects within each other.


                                  9
Android Programming


Property Animation

 Choreographing Multiple Animations with AnimatorSet




                         10
Android Programming


Property Animation

 Choreographing Multiple Animations with AnimatorSet
    1. Plays bounceAnim.

   2. Plays squashAnim1, squashAnim2, stretchAnim1,
    and stretchAnim2 at the same time.

   3. Plays bounceBackAnim.

   4. Plays fadeAnim.


                               11
Android Programming


Property Animation

 Example 13.1




                     12
Android Programming


Android Animation




           Drawable Animation




                    13
Android Programming


Drawable Animation

 Drawable animation lets you load a series of Drawable
  resources one after another to create an animation.

 This is a traditional animation in the sense that it is created
  with a sequence of different images, played in order, like a
  roll of film



 The AnimationDrawable class is the basis for Drawable
  animations.

                               14
Android Programming


Drawable Animation

 While you can define the frames of an animation in your
  code, using the AnimationDrawable class API, it's more
  simply accomplished with a single XML file that lists the
  frames that compose the animation.

 The XML file for this kind of animation belongs in
  the res/drawable/ directory of your Android project.




                             15
Android Programming


Drawable Animation




                     16
Android Programming


Drawable Animation

 Example 13.2




                     17
Android Programming


Android Animation




             View Animation




                    18
Android Programming


View Animation

 You can use the view animation system to perform tweened
  animation on Views.

 Tween animation calculates the animation with information
  such as the start point, end point, size, rotation, and
  other common aspects of an animation.




                            19
Android Programming


View Animation

 There are two types of animations that you can do with the
  view animation framework:

    Tween animation: Creates an animation by performing a series of
     transformations on a single image with an Animation

    Frame animation: or creates an animation by showing a
     sequence of images in order with an AnimationDrawable.




                               20
Android Programming


View Animation

 The animation XML file belongs in the res/anim/ directory
  of your Android project.

 The file must have a single root element: this will be either a
  single <alpha>, <scale>, <translate>, <rotate>,
  interpolator element, or<set> element that holds groups of
  these elements (which may include another <set>).




                              21
Android Programming


View Animation

 Example 13.3




                 22
Android Programming

Weitere ähnliche Inhalte

Was ist angesagt?

Android - Application Framework
Android - Application FrameworkAndroid - Application Framework
Android - Application FrameworkYong Heui Cho
 
Android ui layout
Android ui layoutAndroid ui layout
Android ui layoutKrazy Koder
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android DevelopmentAly Abdelkareem
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)Manisha Keim
 
Broadcast Receivers in Android
Broadcast Receivers in AndroidBroadcast Receivers in Android
Broadcast Receivers in Androidma-polimi
 
Layouts in android
Layouts in androidLayouts in android
Layouts in androidDurai S
 
Supporting multiple screens on android
Supporting multiple screens on androidSupporting multiple screens on android
Supporting multiple screens on androidLi SUN
 
android layouts
android layoutsandroid layouts
android layoutsDeepa Rani
 
Android | Android Activity Launch Modes and Tasks | Gonçalo Silva
Android | Android Activity Launch Modes and Tasks | Gonçalo SilvaAndroid | Android Activity Launch Modes and Tasks | Gonçalo Silva
Android | Android Activity Launch Modes and Tasks | Gonçalo SilvaJAX London
 
android activity
android activityandroid activity
android activityDeepa Rani
 
Android resource
Android resourceAndroid resource
Android resourceKrazy Koder
 
Android activities & views
Android activities & viewsAndroid activities & views
Android activities & viewsma-polimi
 
Android application-component
Android application-componentAndroid application-component
Android application-componentLy Haza
 
GUI Programming In Java
GUI Programming In JavaGUI Programming In Java
GUI Programming In Javayht4ever
 
Android Navigation Component
Android Navigation ComponentAndroid Navigation Component
Android Navigation ComponentŁukasz Ciupa
 

Was ist angesagt? (20)

Android - Application Framework
Android - Application FrameworkAndroid - Application Framework
Android - Application Framework
 
Android ui layout
Android ui layoutAndroid ui layout
Android ui layout
 
Fragment
Fragment Fragment
Fragment
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
SQLITE Android
SQLITE AndroidSQLITE Android
SQLITE Android
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
 
Broadcast Receivers in Android
Broadcast Receivers in AndroidBroadcast Receivers in Android
Broadcast Receivers in Android
 
OpenCV Introduction
OpenCV IntroductionOpenCV Introduction
OpenCV Introduction
 
Layouts in android
Layouts in androidLayouts in android
Layouts in android
 
Supporting multiple screens on android
Supporting multiple screens on androidSupporting multiple screens on android
Supporting multiple screens on android
 
android layouts
android layoutsandroid layouts
android layouts
 
Android | Android Activity Launch Modes and Tasks | Gonçalo Silva
Android | Android Activity Launch Modes and Tasks | Gonçalo SilvaAndroid | Android Activity Launch Modes and Tasks | Gonçalo Silva
Android | Android Activity Launch Modes and Tasks | Gonçalo Silva
 
android activity
android activityandroid activity
android activity
 
Android resource
Android resourceAndroid resource
Android resource
 
Android activities & views
Android activities & viewsAndroid activities & views
Android activities & views
 
Android application-component
Android application-componentAndroid application-component
Android application-component
 
GUI Programming In Java
GUI Programming In JavaGUI Programming In Java
GUI Programming In Java
 
Android Navigation Component
Android Navigation ComponentAndroid Navigation Component
Android Navigation Component
 
Java rmi
Java rmiJava rmi
Java rmi
 
AndroidManifest
AndroidManifestAndroidManifest
AndroidManifest
 

Andere mochten auch

Presentation animation android
Presentation animation android Presentation animation android
Presentation animation android Nadim GOUIA
 
Android App Development - 12 animations
Android App Development - 12 animationsAndroid App Development - 12 animations
Android App Development - 12 animationsDiego Grancini
 
Introduction to Android Animations
Introduction to Android AnimationsIntroduction to Android Animations
Introduction to Android AnimationsXamarin
 
Android Training (Animation)
Android Training (Animation)Android Training (Animation)
Android Training (Animation)Khaled Anaqwa
 
Presentation on Android operating system
Presentation on Android operating systemPresentation on Android operating system
Presentation on Android operating systemSalma Begum
 

Andere mochten auch (7)

Presentation animation android
Presentation animation android Presentation animation android
Presentation animation android
 
Android App Development - 12 animations
Android App Development - 12 animationsAndroid App Development - 12 animations
Android App Development - 12 animations
 
Android animation theory
Android animation theoryAndroid animation theory
Android animation theory
 
Introduction to Android Animations
Introduction to Android AnimationsIntroduction to Android Animations
Introduction to Android Animations
 
Android Training (Animation)
Android Training (Animation)Android Training (Animation)
Android Training (Animation)
 
Android ppt
Android pptAndroid ppt
Android ppt
 
Presentation on Android operating system
Presentation on Android operating systemPresentation on Android operating system
Presentation on Android operating system
 

Ähnlich wie [Android] Android Animation

Animation in android
Animation in androidAnimation in android
Animation in androidJatin_123
 
Seven Peaks Speaks - Android Jetpack Compose Animation
Seven Peaks Speaks - Android Jetpack Compose AnimationSeven Peaks Speaks - Android Jetpack Compose Animation
Seven Peaks Speaks - Android Jetpack Compose AnimationSeven Peaks Speaks
 
Android animations
Android animationsAndroid animations
Android animationsKumar
 
Top Tips for Android UIs - Getting the Magic on Tablets
Top Tips for Android UIs - Getting the Magic on TabletsTop Tips for Android UIs - Getting the Magic on Tablets
Top Tips for Android UIs - Getting the Magic on TabletsMotorola Mobility - MOTODEV
 
Basic Android Animation
Basic Android Animation Basic Android Animation
Basic Android Animation Shilu Shrestha
 
[Android] 2D Graphics
[Android] 2D Graphics[Android] 2D Graphics
[Android] 2D GraphicsNikmesoft Ltd
 
Computer animation Computer Graphics
Computer animation Computer Graphics Computer animation Computer Graphics
Computer animation Computer Graphics University of Potsdam
 
Advance ui development and design
Advance ui  development and design Advance ui  development and design
Advance ui development and design Rakesh Jha
 
[Android] Basic Widgets and Containers
[Android] Basic Widgets and Containers[Android] Basic Widgets and Containers
[Android] Basic Widgets and ContainersNikmesoft Ltd
 
Getting started with Verold and Three.js
Getting started with Verold and Three.jsGetting started with Verold and Three.js
Getting started with Verold and Three.jsVerold
 
Implementing a Splash Screen in Android: Full Guide
Implementing a Splash Screen in Android: Full GuideImplementing a Splash Screen in Android: Full Guide
Implementing a Splash Screen in Android: Full GuideDean Djermanovic
 
Trends in Computer Graphics
Trends in Computer GraphicsTrends in Computer Graphics
Trends in Computer GraphicsSajal Maharjan
 

Ähnlich wie [Android] Android Animation (20)

Animation in android
Animation in androidAnimation in android
Animation in android
 
Seven Peaks Speaks - Android Jetpack Compose Animation
Seven Peaks Speaks - Android Jetpack Compose AnimationSeven Peaks Speaks - Android Jetpack Compose Animation
Seven Peaks Speaks - Android Jetpack Compose Animation
 
Android - Graphics Animation in Android
Android - Graphics Animation in AndroidAndroid - Graphics Animation in Android
Android - Graphics Animation in Android
 
Android animation in android-chapter17
Android animation in android-chapter17Android animation in android-chapter17
Android animation in android-chapter17
 
Android animations
Android animationsAndroid animations
Android animations
 
Top Tips for Android UIs - Getting the Magic on Tablets
Top Tips for Android UIs - Getting the Magic on TabletsTop Tips for Android UIs - Getting the Magic on Tablets
Top Tips for Android UIs - Getting the Magic on Tablets
 
Basic Android Animation
Basic Android Animation Basic Android Animation
Basic Android Animation
 
[Android] 2D Graphics
[Android] 2D Graphics[Android] 2D Graphics
[Android] 2D Graphics
 
Computer animation Computer Graphics
Computer animation Computer Graphics Computer animation Computer Graphics
Computer animation Computer Graphics
 
Animation
AnimationAnimation
Animation
 
Advance ui development and design
Advance ui  development and design Advance ui  development and design
Advance ui development and design
 
ANIMATION SEQUENCE
ANIMATION SEQUENCEANIMATION SEQUENCE
ANIMATION SEQUENCE
 
3.2 ws WMS.pdf
3.2 ws WMS.pdf3.2 ws WMS.pdf
3.2 ws WMS.pdf
 
[Android] Basic Widgets and Containers
[Android] Basic Widgets and Containers[Android] Basic Widgets and Containers
[Android] Basic Widgets and Containers
 
Android view animation in android-chapter18
Android view animation in android-chapter18Android view animation in android-chapter18
Android view animation in android-chapter18
 
Getting started with Verold and Three.js
Getting started with Verold and Three.jsGetting started with Verold and Three.js
Getting started with Verold and Three.js
 
Android canvas-chapter20
Android canvas-chapter20Android canvas-chapter20
Android canvas-chapter20
 
Implementing a Splash Screen in Android: Full Guide
Implementing a Splash Screen in Android: Full GuideImplementing a Splash Screen in Android: Full Guide
Implementing a Splash Screen in Android: Full Guide
 
The world of Android Animations
The world of Android AnimationsThe world of Android Animations
The world of Android Animations
 
Trends in Computer Graphics
Trends in Computer GraphicsTrends in Computer Graphics
Trends in Computer Graphics
 

Mehr von Nikmesoft Ltd

[iOS] Multiple Background Threads
[iOS] Multiple Background Threads[iOS] Multiple Background Threads
[iOS] Multiple Background ThreadsNikmesoft Ltd
 
[iOS] Basic UI Elements
[iOS] Basic UI Elements[iOS] Basic UI Elements
[iOS] Basic UI ElementsNikmesoft Ltd
 
[iOS] Introduction to iOS Programming
[iOS] Introduction to iOS Programming[iOS] Introduction to iOS Programming
[iOS] Introduction to iOS ProgrammingNikmesoft Ltd
 
[Android] Multimedia Programming
[Android] Multimedia Programming[Android] Multimedia Programming
[Android] Multimedia ProgrammingNikmesoft Ltd
 
[Android] Services and Broadcast Receivers
[Android] Services and Broadcast Receivers[Android] Services and Broadcast Receivers
[Android] Services and Broadcast ReceiversNikmesoft Ltd
 
[Android] Web services
[Android] Web services[Android] Web services
[Android] Web servicesNikmesoft Ltd
 
[Android] Multiple Background Threads
[Android] Multiple Background Threads[Android] Multiple Background Threads
[Android] Multiple Background ThreadsNikmesoft Ltd
 
[Android] Maps, Geocoding and Location-Based Services
[Android] Maps, Geocoding and Location-Based Services[Android] Maps, Geocoding and Location-Based Services
[Android] Maps, Geocoding and Location-Based ServicesNikmesoft Ltd
 
[Android] Data Storage
[Android] Data Storage[Android] Data Storage
[Android] Data StorageNikmesoft Ltd
 
[Android] Intent and Activity
[Android] Intent and Activity[Android] Intent and Activity
[Android] Intent and ActivityNikmesoft Ltd
 
[Android] Widget Event Handling
[Android] Widget Event Handling[Android] Widget Event Handling
[Android] Widget Event HandlingNikmesoft Ltd
 
[Android] Using Selection Widgets
[Android] Using Selection Widgets[Android] Using Selection Widgets
[Android] Using Selection WidgetsNikmesoft Ltd
 
[Android] Introduction to Android Programming
[Android] Introduction to Android Programming[Android] Introduction to Android Programming
[Android] Introduction to Android ProgrammingNikmesoft Ltd
 

Mehr von Nikmesoft Ltd (16)

[iOS] Networking
[iOS] Networking[iOS] Networking
[iOS] Networking
 
[iOS] Data Storage
[iOS] Data Storage[iOS] Data Storage
[iOS] Data Storage
 
[iOS] Multiple Background Threads
[iOS] Multiple Background Threads[iOS] Multiple Background Threads
[iOS] Multiple Background Threads
 
[iOS] Navigation
[iOS] Navigation[iOS] Navigation
[iOS] Navigation
 
[iOS] Basic UI Elements
[iOS] Basic UI Elements[iOS] Basic UI Elements
[iOS] Basic UI Elements
 
[iOS] Introduction to iOS Programming
[iOS] Introduction to iOS Programming[iOS] Introduction to iOS Programming
[iOS] Introduction to iOS Programming
 
[Android] Multimedia Programming
[Android] Multimedia Programming[Android] Multimedia Programming
[Android] Multimedia Programming
 
[Android] Services and Broadcast Receivers
[Android] Services and Broadcast Receivers[Android] Services and Broadcast Receivers
[Android] Services and Broadcast Receivers
 
[Android] Web services
[Android] Web services[Android] Web services
[Android] Web services
 
[Android] Multiple Background Threads
[Android] Multiple Background Threads[Android] Multiple Background Threads
[Android] Multiple Background Threads
 
[Android] Maps, Geocoding and Location-Based Services
[Android] Maps, Geocoding and Location-Based Services[Android] Maps, Geocoding and Location-Based Services
[Android] Maps, Geocoding and Location-Based Services
 
[Android] Data Storage
[Android] Data Storage[Android] Data Storage
[Android] Data Storage
 
[Android] Intent and Activity
[Android] Intent and Activity[Android] Intent and Activity
[Android] Intent and Activity
 
[Android] Widget Event Handling
[Android] Widget Event Handling[Android] Widget Event Handling
[Android] Widget Event Handling
 
[Android] Using Selection Widgets
[Android] Using Selection Widgets[Android] Using Selection Widgets
[Android] Using Selection Widgets
 
[Android] Introduction to Android Programming
[Android] Introduction to Android Programming[Android] Introduction to Android Programming
[Android] Introduction to Android Programming
 

Kürzlich hochgeladen

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Kürzlich hochgeladen (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

[Android] Android Animation

  • 1. Android Programming Lesson 13 Android Animation NGUYEN The Linh
  • 2. Android Programming Contents 1 Property Animation 2 Drawable Animation 3 View Animation 2
  • 4. Android Programming Property Animation  Animating with ValueAnimator  The ValueAnimator class lets you animate values of some type for the duration of an animation by specifying a set of int, float, or color values to animate through. You obtain a ValueAnimator by calling one of its factory methods: ofInt(), ofFloat(), or ofObject(). For example: 4
  • 5. Android Programming Property Animation  Animating with ValueAnimator  The previous code snippets, however, has no real effect on an object, because the ValueAnimator does not operate on objects or properties directly.  You do this by defining listeners in the ValueAnimator to appropriately handle important events during the animation's lifespan, such as frame updates. 5
  • 6. Android Programming Property Animation  Animating with ValueAnimator  When implementing the listeners, you can obtain the calculated value for that specific frame refresh by calling getAnimatedValue()  Animator.AnimatorListener • onAnimationStart() - Called when the animation starts. • onAnimationEnd() - Called when the animation ends. • onAnimationRepeat() - Called when the animation repeats itself. 6
  • 7. Android Programming Property Animation  Animating with ValueAnimator  Animator.AnimatorListener • onAnimationCancel() - Called when the animation is canceled. A cancelled animation also calls onAnimationEnd(), regardless of how they were ended.  ValueAnimator.AnimatorUpdateListener • onAnimationUpdate() - called on every frame of the animation. 7
  • 8. Android Programming Property Animation  Animating with ObjectAnimator  The ObjectAnimator is a subclass of he ValueAnimator (discussed in the previous section) and combines the timing engine and value computation of ValueAnimator with the ability to animate a named property of a target object. 8
  • 9. Android Programming Property Animation  Choreographing Multiple Animations with AnimatorSet  In many cases, you want to play an animation that depends on when another animation starts or finishes.  The Android system lets you bundle animations together into an AnimatorSet, so that you can specify whether to start animations simultaneously, sequentially, or after a specified delay.  You can also nest AnimatorSet objects within each other. 9
  • 10. Android Programming Property Animation  Choreographing Multiple Animations with AnimatorSet 10
  • 11. Android Programming Property Animation  Choreographing Multiple Animations with AnimatorSet  1. Plays bounceAnim.  2. Plays squashAnim1, squashAnim2, stretchAnim1, and stretchAnim2 at the same time.  3. Plays bounceBackAnim.  4. Plays fadeAnim. 11
  • 13. Android Programming Android Animation Drawable Animation 13
  • 14. Android Programming Drawable Animation  Drawable animation lets you load a series of Drawable resources one after another to create an animation.  This is a traditional animation in the sense that it is created with a sequence of different images, played in order, like a roll of film  The AnimationDrawable class is the basis for Drawable animations. 14
  • 15. Android Programming Drawable Animation  While you can define the frames of an animation in your code, using the AnimationDrawable class API, it's more simply accomplished with a single XML file that lists the frames that compose the animation.  The XML file for this kind of animation belongs in the res/drawable/ directory of your Android project. 15
  • 19. Android Programming View Animation  You can use the view animation system to perform tweened animation on Views.  Tween animation calculates the animation with information such as the start point, end point, size, rotation, and other common aspects of an animation. 19
  • 20. Android Programming View Animation  There are two types of animations that you can do with the view animation framework:  Tween animation: Creates an animation by performing a series of transformations on a single image with an Animation  Frame animation: or creates an animation by showing a sequence of images in order with an AnimationDrawable. 20
  • 21. Android Programming View Animation  The animation XML file belongs in the res/anim/ directory of your Android project.  The file must have a single root element: this will be either a single <alpha>, <scale>, <translate>, <rotate>, interpolator element, or<set> element that holds groups of these elements (which may include another <set>). 21