© 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.

Slides:



Advertisements
Similar presentations
CE881: Mobile and Social Application Programming Simon M. Lucas Menus and Dialogs.
Advertisements

Chapter 3: Engage! Android User Input, Variables, and Operations
Creating Animations – Lesson 71 Creating Animations Lesson 7.
Chapter 6 Jam! Implementing Audio in Android Apps.
Chapter 6: Jam! Implementing Audio in Android Apps.
Create slices and hotspots Create links in Web pages Create rollovers from slices Create basic animation Add tweening symbol instances to create animation.
Chapter 8 – Part I Interactive Multimedia Authoring with Flash: Animation “Computers and Creativity” Richard D. Webster, COSC 109 Instructor Office: 7800.
© 2010 Delmar, Cengage Learning Chapter 4: Creating Animation.
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 a MagicInfo Pro Screen Template
Creating Android user interfaces using layouts 1Android user interfaces using layouts.
Chien-Chung Shen Manifest and Activity Chien-Chung Shen
© 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.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
Chapter 10: Move! Creating Animation
6-2 2D Graphics CSNB544 Mobile Application Development Thanks to Utexas Austin.
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.
© 2010 Delmar, Cengage Learning Chapter 3: Working with Symbols and Interactivity.
Engage! Android User Input, Variables,
SpotOn Game App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
© 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.
Flash Adobe Flash Introduction Kyungeun Park. Bitmap vs. Vector based  Bitmap –Bitmaps are made up of single pixels  Vector based –Vector graphics are.
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 Chapter 3 - WORKING WITH SYMBOLS AND INTERACTIVITY.
Adobe Flash CS3 Revealed
Animate picture to peek from bottom (1 of 3) 1. Right click on picture you want to animate. 2. Click on Custom Animation. 2 1 R.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 2: Simplify! The Android User Interface.
Learning With Computers I (Level Green) ©2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly.
© 2011 Delmar, Cengage Learning Chapter 4 Creating Animations.
© 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.
Learning With Computers II (Level Orange) ©2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly.
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.
© 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.
Slide 1 VB Graphics Controls & Timer Control. Slide 2 Default Controls.
© 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.
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.
CHAPTER 5 Graphics Drawing Audio. Chapter objectives: Learn to draw to a canvas Examine the process of adding drawn elements and UI controls to a layout.
Lecture 3: Animation & Graphics Topics: Animation, Graphics, Drawing Date: Feb 2, 2016.
 Movieclip symbols are reusable pieces of flash animation  consisting usually of one or more graphic/button symbols  thus they are flash movies within.
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 2: Simplify! The Android User Interface
Android Application 2D Graphics cs.
Android Boot Camp for Developers Using Java, 3E
MAD.
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
Android SDK & App Development
Presentation transcript:

© 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 for Developers Using Java, 3E Chapter 10: Move! Creating Animation 1 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 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 2 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 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 3 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Creating Animation 4 Android Boot Camp for Developers Using Java, 3rd Ed. Animation is everywhere –Words with Friends –Angry Birds –Cut the Rope –Candy Crush A motion tween is used to animate the object –Specifies start state –Transition type –Number of times to animate

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Creating Animation (continued) Steps to complete the App: 1.Add the four images to the drawable folder. 2.Add a Frame animation XML file to the project. 3.Add the layout for the image and button objects in main.xml. 4.Set the duration between frames in the frame-by-frame animation. 5.Declare and instantiate the ImageView, Button, and AnimationDrawable controls. 6.Code the OnClickListeners for the Button controls. 7.Run the Frame animation application. 8.Add a Tween animation XML file to rotate the last surfing image. 9.Create a second Activity named Tween.java to launch the rotation Tween animation. 10.When the application executes, change the orientation of the emulator. 5 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 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 6 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Adding the Layout for the Frame Image and Button Controls 7 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 8 Android Boot Camp for Developers Using Java, 3rd Ed. Adding the Layout for the Frame Image and Button Controls (continued)

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 9 Android Boot Camp for Developers Using Java, 3rd Ed. Adding the Layout for the Frame Image and Button Controls (continued)

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 10 Android Boot Camp for Developers Using Java, 3rd Ed. Adding the Layout for the Frame Image and Button Controls (continued)

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Creating Frame-by-frame Animation 11 Android Boot Camp for Developers Using Java, 3rd Ed. 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

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Creating Frame-by-frame Animation (continued) 12 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Creating Frame-by-frame Animation (continued) 13 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. The AnimationDrawable class –provides the methods for drawable animations to create a sequence of frame-by-frame images –In Android development, frame-based animations and image transitions are defined as drawables –The instance of AnimationDrawable is instantiated as a class variable because it is used in multiple methods within the MainActivity class Coding the AnimationDrawable Object 14 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Setting the Background Resource 15 Android Boot Camp for Developers Using Java, 3rd Ed. –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 –setBackgroundResource method places images in the frame-by-frame slide type display Each frame points to one of the images that were assembled in the XML resource file The imgFrame instance is the image that you want to animate and is set to the animation drawable as its background

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Setting the Background Resource (continued) 16 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Setting the Background Resource (continued) 17 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 18 Android Boot Camp for Developers Using Java, 3rd Ed. Setting the Background Resource (continued)

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Adding Two Button Controls 19 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Adding Two Button Controls (continued) 20 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Adding Two Button Controls (continued) 21 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Adding Two Button Controls (continued) 22 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Using the Start and Stop Methods 23 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Using the Start and Stop Methods (continued) 24 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Creating Tween Animation 25 Android Boot Camp for Developers Using Java, 3rd Ed. Tween effects are transitions that change objects from one state to another

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Creating a Second Activity and XML Layout to Launch the Tween Animation 26 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Creating a Second Activity and XML Layout to Launch the Tween Animation 27 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Adding the Layout for the Tween Image 28 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Coding a Tween Rotation XML File 29 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Coding a StartAnimation 30 Android Boot Camp for Developers Using Java, 3rd Ed. The StartAnimation method begins animating a View object by calling the AnimationUtils class utilities to access the resources necessary to load the animation

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Coding a StartAnimation (continued) 31 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Changing the Emulator to Landscape Orientation 32 Android Boot Camp for Developers Using Java, 3rd Ed. Most Android devices automatically rotate the display from portrait to landscape when the user turns the device The default screen orientation layout is vertical Pressing the Fn+left Ctrl+F12 keys simultaneously rotates the phone emulator to landscape orientation You can also press the 7 key on the keypad when Num Lock is turned off

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Running and Testing the Application Tap or click the Run ‘app’ button on the Standard toolbar and display the app in the Nexus 5 emulator Tap or click the START FRAME ANIMATION button to begin the Frame animation of the four Northern Lights images, as shown in Figure 10-1 The animation should rotate six times and then end 33 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Summary Frame animation assigns a sequence of images to play as in a slide show with a specified interval between images To create a Frame animation, you write code in an XML file to load a sequence of images from the drawable folder In the animation-list code, you can include the oneshot property to determine how many times to play the animation 34 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Summary (continued) When you add the XML file with the animation-list code to the Android project, select Drawable as the resource type and select animation-list as the root element so that Android stores the XML file in the res/drawable folder The AnimationDrawable class provides the methods for drawable animations to create a sequence of frame-by-frame images You can set the Background property of an image to any full Drawable resource such as a.png file 35 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Summary (continued) In MainActivity.java, also include an instance of AnimationDrawable and assign it as the background of the animation images You can 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 36 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Summary (continued) 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 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 37 Android Boot Camp for Developers Using Java, 3rd Ed.

© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Summary (continued) To switch the emulator to use a landscape orientation on a PC, press the Fn+left Ctrl+F12 keys. To rotate the emulator to the original portrait position, press the Fn+left Ctrl+F12 keys again. Mac users can press the Fn+Ctrl+F12 keys to change the orientation 38 Android Boot Camp for Developers Using Java, 3rd Ed.