+ All Categories
Home > Software > Basic Android Animation

Basic Android Animation

Date post: 22-Jan-2018
Category:
Upload: shilu-shrestha
View: 363 times
Download: 0 times
Share this document with a friend
32
Basic View Animation in Android By Shilu Shrestha
Transcript
Page 1: Basic Android Animation

Basic View Animation

in AndroidBy Shilu Shrestha

Page 2: Basic Android Animation

Pre-requisites

• Installed well functioning Android Studio

• Basic knowledge of programming in Android is a

plus

Page 3: Basic Android Animation

animationanɪˈmeɪʃ(ə)n/

noun

the state of being full of life or vigour;

liveliness.

Page 4: Basic Android Animation

Why do we need

Animation in Android?

Page 5: Basic Android Animation

• Notify when screen changes its state; Such as

when content load is complete.

• Communicate quickly and concisely with your user.

• Adds a polished finished look to your app.

Page 6: Basic Android Animation

Animation in Android

Page 7: Basic Android Animation

Property Animation

Page 8: Basic Android Animation

• A property animation changes a property's (a field in

an object) value over a specified length of time.

• Property animation allows you to animate almost

anything.

Page 9: Basic Android Animation

View Animation

• Tween Animation

• Frame Animation

Page 10: Basic Android Animation

Tween Animation

Page 11: Basic Android Animation

• Perform a series of simple transformations

(position, size, rotation, and transparency) on the

contents of a View object.

• Calculates the animation with information such as

the start point, end point, size, rotation, and other

common aspects of an animation.

• Can be done using XML or Programmatically

Page 12: Basic Android Animation

Animation using XML File

• Like all xml there should be one root file

• File location:

• res/anim

• The elements performing xml animations are

• <alpha>

• <scale>

• <rotate>

• <translate>

• Animation elements maybe grouped using <set> element.

Page 13: Basic Android Animation

• <alpha> : fade in / fade out

• <android:fromAlpha>

• <android:toAlpha>

• “1.0" : opaque

• “0.0” : transparent

Page 14: Basic Android Animation

• <scale> : resize image

• <android:fromXScale>

• <android:toXScale>

• <android:fromYScale>

• <android:toYScale>

• <android:pivotX>

• <android:pivotY>

Page 15: Basic Android Animation

• <rotate> : rotation animation

• <android:fromDegrees>

• <android:toDegrees>

• <android:pivotX>

• <android:pivotY>

Page 16: Basic Android Animation

• <translate> : a vertical or horizontal translation

• <android:fromXDelta>

• <android:toXDelta>

• <android:fromYDelta>

• <android:toYDelta>

Page 17: Basic Android Animation

Demo

Page 18: Basic Android Animation

Animation Listener

• Animation listener receives notifications from

animation.

• onAnimationStart (Animation animation)

• onAnimationRepeat (Animation animation)

• onAnimationEnd (Animation animation)

Page 19: Basic Android Animation

Animation using Java Code

Page 20: Basic Android Animation
Page 21: Basic Android Animation
Page 22: Basic Android Animation
Page 23: Basic Android Animation
Page 24: Basic Android Animation

Demo

Page 25: Basic Android Animation

Frame Animation

Page 26: Basic Android Animation

• An animation defined in XML which shows the

sequence of images in order.

• File location:

• res/drawable/<filename>.xml

• Elements

• <animation-list> : root element contains list of

<item>

• <android:oneshot> : attribute to loop animation

Page 27: Basic Android Animation

Demo

Page 28: Basic Android Animation

Some Ideas

Page 29: Basic Android Animation
Page 30: Basic Android Animation
Page 31: Basic Android Animation

• Final Repo: https://github.com/shilu-stha/Basic-

Animations

Page 32: Basic Android Animation

Thank-you


Recommended