• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Android animation
 

Android animation

on

  • 624 views

 

Statistics

Views

Total Views
624
Views on SlideShare
624
Embed Views
0

Actions

Likes
0
Downloads
7
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Android animation Android animation Presentation Transcript

    • Mobile Computing – 650003 MCA – ISTAR, V.V. Nagar 1Mr. Pritesh N. Patel (ISTAR)
    • Types of Animation Android support following types of animation 1. Animated GIF files 2. Frame-by-Frame Animation 3. Tweened Animation 2Mr. Pritesh N. Patel (ISTAR)
    •  In these type of animation, a series of similar images displayed in sequence, each image is different from one another from first to last.  It display images so quickly by giving illusion of moving animation.  These type of animation is used when transformation is not easy with programming. Code Sample 3Mr. Pritesh N. Patel (ISTAR) Frame-by-Frame Animation
    •  In these type of animation, animation can perform simple transformation on the content of view.  Transformation can be position, size, rotation and transparency.  The animation package provide all the classes used in tween animation like RotateAnimation, ScaleAnimation, Transformation, TranslateAnimation, etc.  We can also provide transformation to any view. Code Sample 4Mr. Pritesh N. Patel (ISTAR) Tweened Animation
    •  We can define animation programmatically using classes available in android.view.animation package. For e.g. to define rotation RotateAnimation r = new RotateAnimation( 0, 360, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); r.setDuration(500); 5Mr. Pritesh N. Patel (ISTAR) Define Tweened Animation Programmatically
    •  RotateAnimation (float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue)  ScaleAnimation (float fromX, float toX, float fromY, float toY, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue)  TranslateAnimation (int fromXType, float fromXValue, int toXType, float toXValue, int fromYType, float fromYValue, int toYType, float toYValue) 6Mr. Pritesh N. Patel (ISTAR) Syntax:
    •  We can define animation as XML resource at file location res/anim/my_anim.xml like (see syntax in given doc file) <set android:interpolator="@android:anim/accelerate_interp olator” android:startOffset="700"> <rotate android:fromDegrees="0" android:toDegrees="-45" android:toYScale="0.0" android:pivotX="50%" android:pivotY="50%" android:duration="400" /> </set> 7Mr. Pritesh N. Patel (ISTAR) Define Tweened Animation as XML Resource