Mobile Computing Systems


Download 10.9 Kb.
bet1/4
Sana18.06.2023
Hajmi10.9 Kb.
#1563379
  1   2   3   4

Lecture 3: Animation & Graphics


Topics: Animation, Graphics, Drawing
Date: Jan 31, 2016

References (study these)

  • http://developer.android.com/guide/topics/graphics/overview.html
  • http://developer.android.com/guide/topics/graphics/prop-animation.html
  • http://developer.android.com/guide/topics/graphics/view-animation.html
  • http://developer.android.com/guide/topics/graphics/drawable-animation.html
  • http://developer.android.com/guide/topics/graphics/2d-graphics.html

High Five!


https://youtu.be/uFpoXq73HHY

Animation Overview

1. Property Animation (Value)

  • Changing value of a variable over a period:
  • Use setInterpolator() to change behavior.

ValueAnimator anim = ValueAnimator.ofFloat(0f, 40f); anim.setDuration(40); anim.start();
Limitation?

1. Property Animation (Object)

  • Changing a property of an object.

ObjectAnimator anim =
ObjectAnimator.ofFloat(myTextView, “textSize”, 10f, 30f); anim.setDuration(5000); anim.start();
Hello World
Hello World
Hello World
Object
Variable

2. View Animation

  • You can animate a View e.g., by scaling, rotating, translating an ImageView.

2. View Animation

  • Define the Animation in XML: res/anim
  • Use Animation to fetch it, then apply it to a View.

xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="0" android:toDegrees="360" android:toYScale="0.0" android:pivotX="50%" android:pivotY="50%" android:startOffset=“1000" android:duration="10000" />

Download 10.9 Kb.

Do'stlaringiz bilan baham:
  1   2   3   4




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling