GTU Android Program 10 Tween Animation Example

GTU Android Program 10 Create an application that will have spinner with list of animation names. On selecting animation name , that animation should affect on the images displayed below.

GTU Android Program 10

We love Animation ! We play games which gives pleasure to us. Most of the android games are based on the Tween Animations.  Here I am explaining how you can do tween animation and animate one image as per the animation parameter you have setup. Here in the example I have prepared 4 different animation named Alpha, Rotate, Scale, Translate. Make sure you follow following step.


Step 1 : Create android project.

Step 2 : Add Image into res/drawable folder so that we can implement animation on it.

Step 3 : create folder “anim” in res folder.

Step 4 : add rotate.xml, scale.xml, alpha.xml and tranlate.xml into res/anim folder

For above steps refer following code.

If you are doing first time and confuse to do tween animation, I suggest download complete code using link at bottom.

Questions Related with Android Tween Animation.

  • Explain different types of Animation in Android.
  • Explain animation supported by Android taking suitable example
  • Differentiate Frame-by-frame Animation and Tweened Animation
  • What is Frame-by-Frame Animation? How it is different from Tweened Animation? Explain creating frame-by-frame animation taking suitable example.
  • Translate animation, taking 7 seconds to move an object up by 100 on y axis
    • use Translate animation with 7000 duration
  • Transparency change animation, taking 7 seconds to fade from fully transparent to fully opaque
    • use alpha animation with 7000 duration from 0 to 1
  • Rotation animation, taking 7 seconds to make one full clockwise rotation, pivoting from the center of the object.
    • use rotate animation with 7000 duration
  • Transparency change animation taking 10 seconds to fade in fully transparent to fully opaque
    • use android alpha animation, set duration to 10000,  from 0 to 1
  • Scaling animation, taking 5 seconds to double an object’s size, pivoting from the center of the object
    • use android scale animation, set duration to 5000
  • Translate  animation, taking 5 seconds to move an object up by 100 on the y axis and object should not jump back to its starting position when the animation finishes
    • use android translate animation.
  • For what purpose animation interpolator is used? How it can be specified
    programmatically?

    • An interpolator means rate of change of an animation (mostly it is used for smooth curve). This allows the basic animation effects (alpha, scale, translate, rotate)

Location : res\layout

FileName: activity_main.xml

 

Location : src\package\

FileName : MainActivity.java

 

Location : res\anim

FileName: alpha.xml

 

Location : res\anim

FileName: rotate.xml

 

Location : res\anim

FileName: scale.xml

 

Location : res\anim

FileName: translate.xml

 

Output of Alpha Animation Step 1

GTU Android Program 10

Output of Alpha Animation Step 2

GTU Android Program 10

Output of Rotate Animation

GTU Android Program 10

Output of Scale Animation

GTU Android Program 10

Output  of Translate Animation

GTU Android Program 10

Download Complete Project with all animation files and image

Download Few Popular Android Apps

  1. Bank IFSC Code : Now easily get bank ifsc code which you need while online transfer.
  2. All India PIN Code : Get all india PIN Code Numbers on 1 Android App.
  3. RTO Code : Get all India RTO Code on 1 Android App.
  4. Google 2 Step Code Speak : Now app will speak your google 2 step code, so no need to check mobile, code will reach you.
  5. All Gujarat ST Bus Stand Helpline Numbers (GSRTC Helpline Numbers)
  6. Mumbai City Bus Numbers (MSRTC Helpline Numbers)

  7. Andhra Pradesh City Bus Helpline Numbers (APSRTC Helpline Numbers)

  8. Bhavnagar Diary (Bhavnagar Business Directory)

  9. Baroda Diary (Baroda Business Directory)
  10. Surat Diary (Surat Business Directory)
  11. Ahmedabad Diary (Ahmedabad Business Directory)
  12. Rajkot Diary (Rajkot Business Directory)

Adarsh Patel

My Self Adarsh Suryakant Patel. Currently I am working as Assistant Professor at Parul Instiute of Engineering and Technology, MCA Department, Limda, Vadodara. Major Responsibility : * Lectures * Organizing Training and Expert Sessions for * Placement and Recruitment * Faculty Representative