Chapter 10: Move! Creating Animation

Slides:



Advertisements
Similar presentations
MS® PowerPoint.
Advertisements

Chapter 3 Creating a Business Letter with a Letterhead and Table
Chapter 3: Engage! Android User Input, Variables, and Operations
Chapter 3 Setting Up A Document.
Creating Animations – Lesson 71 Creating Animations Lesson 7.
Chapter 6 Jam! Implementing Audio in Android Apps.
Chapter 6: Jam! Implementing Audio in Android Apps.
Chapter 6 Photoshop and ImageReady: Part II The Web Warrior Guide to Web Design Technologies.
Adobe Photoshop CS Design Professional FOR THE WEB CREATING IMAGES.
Introduction to PowerPoint
Create slices and hotspots Create links in Web pages Create rollovers from slices Create basic animation Add tweening symbol instances to create animation.
Copyright 2007, Paradigm Publishing Inc. POWERPOINT 2007 CHAPTER 1 BACKNEXTEND 1-1 LINKS TO OBJECTIVES Create Presentation Open, Save, Run, Print, Close,Delete.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
Creating Android user interfaces using layouts 1Android user interfaces using layouts.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. M I C R O S O F T ® Animating and Using Multimedia Effects Lesson 10.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 9: Customize! Navigating with a Master/Detail.
Chapter 5: Investigate! Lists, Arrays, and Web Browsers.
Chapter 9: Customize! Navigating with Tabs on a Tablet App.
1 Flash Basics by Dr SC Li. 2 File Types  In general, Flash 5.0 generates 3 types of files:  ???.fla  Flash ’ s working file  ???.swf  Flash movie.
Chapter Seven: Presentation Software (MS PowerPoint 2007) Author(s): Ahmed Dalalah, Ahmed Abusalameh, Mohammad AlZoubi & Khaled Dajani (Prepared By: Ahmed.
Chapter 2: Simplify! The Android User Interface
Flag Quiz App 1 CS7030: Mobile App Development. assets Folder 2 CS7030: Mobile App Development  drawable folder – Image contents at the root level 
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 5: Investigate! Android Lists, Arrays,
Animation.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Chapter 10 Fireworks: Part II The Web Warrior Guide to Web Design Technologies.
Chapter 2 The Android User Interface. Objectives  In this chapter, you learn to:  Develop a user interface using the TextView, ImageView, and Button.
Engage! Android User Input, Variables,
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
SpotOn Game App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 7: Reveal! Displaying Pictures in a GridView.
Android Boot Camp for Developers Using Java, 3E
Chapter 7: Reveal! Displaying Pictures in a Gallery.
Adobe Flash CS3 Revealed
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 2: Simplify! The Android User Interface.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Motion Tweening – Lesson 81 Motion Tweening Lesson 8.
Adobe Photoshop CS3 Revealed – Chapter 16 FOR THE WEB CREATING IMAGES.
Animations 1 Fall 2012 CS2302: Programming Principles.
First Venture into the Android World Chapter 1 Part 2.
© 2011 Delmar, Cengage Learning Chapter 3 Setting Up A Document.
Mobile Programming Lecture 11 Animation and TraceView.
Macromedia Flash 8 Revealed WORKING WITH SYMBOLS AND INTERACTIVITY.
Tutorial 3 Creating Animations. XP Objectives Learn the different elements of animation Create frames and layers Organize frames and layers using the.
Chapter2 Create animation. Objectives Import image Use the blank keyframe Add sound Publish the movie as an SWF file Use a motion tween animation.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Basic Animation. Animation 4 options – Animated.gif – Frame by Frame animation – Tweened animation This is our focus – OpenGL ES Graphics API for more.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Chapter 3 I Need a Tour Guide (Introduction to Visual Basic 2010) Clearly Visual Basic: Programming with Visual Basic nd Edition.
XP Tutorial 3 Creating Animations. XP New Perspectives on Macromedia Flash MX Elements of Animation Layers are used to organize the content of.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Animations in GIMP GIMP Lesson 4 Animations: Chapter 3 pp Beginning GIMP From Novice to Professional.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Flag Quiz Game App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
XP New Perspectives on Macromedia Dreamweaver MX 2004 Tutorial 5 1 Adding Shared Site Elements.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 10: Move! Creating Animation 1 Android.
The Flag Quiz app tests your ability to correctly identify 10 flags from various countries and territories.
Chapter 5: Investigate! Lists, Arrays, and Web Browsers.
Chapter 11 Enhancing an Online Form and Using Macros Microsoft Word 2013.
Chapter 2: Simplify! The Android User Interface
Lecture 3: Animation & Graphics
Chapter 4: Explore! Decision-Making Controls
Lecture 3: Animation & Graphics
Android Boot Camp for Developers Using Java, 3E
Mobile Computing With Android ACST 4550 Android Animation
Using Templates and Library Items
Presentation transcript:

Chapter 10: Move! Creating Animation

Objectives In this chapter, you learn to: Create an Android application with Frame and Tween animation Understand Frame animation Understand Tween animation Add an animation-list XML file Code the AnimationDrawable object Set the background Drawable resource Launch the start( ) and stop( ) methods Android Boot Camp for Developers using Java

Objectives (continued) Add Tween animation to the application Create a Tween XML file that rotates an image Determine the rotation pivot, duration, and repeat count of a Tween animation Load the startActivity Tween animation in a second Activity Change the orientation of the emulator Android Boot Camp for Developers using Java

Creating Animation Animation is everywhere Words with Friends Angry Birds Cut the Rope Roller Ball A motion tween is used to animate the object Specifies start state Transition type Number of times to animate Figure 10-2 Wave Animation Android app using Tween animation Android Boot Camp for Developers using Java

Creating Animation (continued) Steps to complete the App: Add the four images to the drawable folder. Add a Frame animation XML file to the project. Add the layout for the image and button objects in main.xml. Set the duration between frames in the frame-by-frame animation. Declare and instantiate the ImageView, Button, and AnimationDrawable controls. Code the OnClickListeners for the Button controls. Run the frame-by-frame Animation application. Add a layout for an ImageView control for the Tween animation. Add a Tween animation XML file to rotate the last surfing image. Create a second Activity named Tween.java to launch the rotation Tween animation. When the application executes, change the orientation of the emulator. Android Boot Camp for Developers using Java

Android Animation Two types of animation for Android: Frame animation A sequence of photos playing as a slide show Similar to cartoon animation Images rapidly replaced by new, similar images Tween animation Created by a series of transformations on a single image Transformations include position, size, shape rotation, color, and transparency Android Boot Camp for Developers using Java

Adding the Layout for the Frame Image and Button Controls This app requires nested layout – relative layout within a linear layout Linear layout ImageView control displays the animation images Relative layout Buttons arranged side by side (not allowed in linear layout) Android Boot Camp for Developers using Java

Adding the Layout for the Frame Image and Button Controls (continued) Figure 10-5 Two button controls in XML code Android Boot Camp for Developers using Java

Adding the Layout for the Frame Image and Button Controls (continued) Creating Frame-by-frame Animation Animation-list root element is needed to reference images stored in the drawable folders Set the android:oneshot property to false for the animation plays repeatedly <?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false" > <item android:drawable="@drawable/surf1" android:duration="100"/> <item android:drawable="@drawable/surf2" android:duration="100"/> <item android:drawable="@drawable/surf3" android:duration="100"/> <item android:drawable="@drawable/surf4" android:duration="100"/> </animation-list> Android Boot Camp for Developers using Java

Coding the AnimationDrawable Object The AnimationDrawable class Contains methods to sequence frame-by-frame images Figure 10-10 Instantiating AnimationDrawable Android Boot Camp for Developers using Java

Setting the Background Resource Image backgrounds can be set to: A 9-patch image Contains pre-defined stretching areas that maintain the same look on different screen sizes Named for the nine areas, called patches, that scale separately A solid color background Android Boot Camp for Developers using Java

Setting the Background Resource (continued) Figure 10-13 getBackground prepares the Animation drawable Android Boot Camp for Developers using Java

Adding Two Button Controls Figure 10-14 btFrame is the instance of the first button Figure 10-15 btTween is the instance of the second button Android Boot Camp for Developers using Java

Adding Two Button Controls (continued) Figure 10-16 First button OnClickListener Android Boot Camp for Developers using Java

Adding Two Button Controls (continued) Figure 10-17 Second button OnClickListener Android Boot Camp for Developers using Java

Using the Start and Stop Methods Figure 10-18 Entering the start() method Figure 10-19 Entering the stop() method Android Boot Camp for Developers using Java

Using the Start and Stop Methods (continued) Adding the Layout for the Tween Image Figure 10-21 ImageView control coded in tween.xml Android Boot Camp for Developers using Java

Using the Start and Stop Methods (continued) Creating Tween Animation Tween effects are transitions that change objects from one state to another Table10-1 Tween animation effects Android Boot Camp for Developers using Java

Using the Start and Stop Methods (continued) Coding a Tween Rotation XML File <?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="0" android:toDegrees="359" android:pivotX="50%" android:pivotY="50%" android:duration="2000" android:repeatCount="5" rotate /> Android Boot Camp for Developers using Java

Using the Start and Stop Methods (continued) Coding a Second Activity to Launch the Tween Animation Figure 10-25 Main.java launches the second Activity (complete code for Main.java) Android Boot Camp for Developers using Java

Using the Start and Stop Methods (continued) Coding a StartAnimation Figure 10-26 onCreate method in Tween.java Figure 10-27 tween.xml layout is set Android Boot Camp for Developers using Java

Using the Start and Stop Methods (continued) Figure 10-28 ImageView is instantiated Figure 10-29 Image rotates using Tween animation (complete code for Tween.java) Android Boot Camp for Developers using Java

Using the Start and Stop Methods (continued) Updating the Android Manifest File Figure 10-30 Adding the Tween Activity to the Android Manifest File Android Boot Camp for Developers using Java

Using the Start and Stop Methods (continued) Updating the Android Manifest File Figure 10-31 Adding the theme to the Android Manifest File Android Boot Camp for Developers using Java

Changing the Emulator to Landscape Orientation Most Android devices automatically rotate the display from portrait to landscape when the user turns the device The default screen orientation layout is vertical Ctrl + F12 rotates the phone emulator to landscape orientation You can also press the 7 key on the keypad when Num Lock is turned off Android Boot Camp for Developers using Java

Running and Testing the Application Click Run on the menu bar Select Android Application from the dialog box Save all the files when prompted Unlock the emulator (if necessary) Click the Start Frame Animation and begin the rotation The animation should rotate six times and then end Android Boot Camp for Developers using Java

Summary Frame animation and Tween animation are the two types of animation provided by Android Nest a relative layout within a linear layout to display two controls side by side To create frame animation, load images in a drawable folder and then create an animation list Set the oneshot property of the animation-list to false to repeatedly play the animation In the XML file, select drawable as the resource type and animation-list as the root element Android Boot Camp for Developers using Java

Summary (continued) Frame-based animations and image transitions are defined as drawables in Android Development The Background property can be set to any full drawable resource Main.java includes an instance of AnimationDrawable and assigns it as the background of the animation images. Android constructs an AnimationDrawable Java object before setting it as the background Android Boot Camp for Developers using Java

Summary (continued) Use the start( ) and stop( ) methods of the drawable objects to control a Frame animation A Tween animation manipulates a Drawable image by adding tween effects, which are predefined transitions that change an object from one state to another The XML file for a Tween animation defines rotate attributes such as the number of degrees to spin, the pivot location, the rotation duration, and the number of times to repeat the rotation Android Boot Camp for Developers using Java

Summary (continued) To launch a Tween animation, use the startAnimation method, which begins animating a View object by calling the AnimationUtils class utilities to access the resources it needs to play the animation To switch the emulator to use a landscape orientation on a PC, press the Ctrl+F12 keys. To rotate the emulator to the original portrait position, press the Ctrl+F12 keys again. Mac users can press the Fn+Ctrl+F12 keys to change the orientation Android Boot Camp for Developers using Java