rent-now

Rent More, Save More! Use code: ECRENTAL

5% off 1 book, 7% off 2 books, 10% off 3+ books

9781590595183

Foundation Actionscript Animation

by
  • ISBN13:

    9781590595183

  • ISBN10:

    1590595181

  • Format: Paperback
  • Copyright: 2005-10-24
  • Publisher: Apress
  • Purchase Benefits
  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $44.99 Save up to $30.59
  • Buy New
    $44.95
    Add to Cart Free Shipping Icon Free Shipping

    USUALLY SHIPS IN 2-3 BUSINESS DAYS

Summary

Sure you can animate using motion tweens, in fact we'll help you do that with our Flash Cartoon Animation book, but isn't there something extra special in making things move with just a few lines of code?In this book Keith Peters guides us through some basic animation theory and then demystifies the math and physics behind creating realistic animation, looking at trigonometry, velocity and acceleration, and bouncing & friction.This book will teach you how to use Flash ActionScript to move the objects in your movies, rather than letting Flashs tween engine do it for you. The benefit of this is smaller, more realistic, more dynamic interactive movies that seem to come alive on your screen. Almost all of the code featured in this book will work fine in either Flash MX 2004 or Flash 8, and with a few minor adjustments, most of it can even be applied to Flash MX.Although the text covers many advanced math and physics concepts, making for very realistic motion, theres no need to worry, even if youre a relative newcomer to programming and the last math class you took was in high school (and even if you barely remember that!). This book first covers everything you need to know to get started: the principles of animation, and the basics of ActionScript, trigonometry, and Flash rendering methods. Youll work your way slowly from using code to move a single object across the screen to creating complex systems that really push Flashs capabilities with topics covered including collision detection, particle attraction, and kinematics. The book concludes with looking at 3D animation techniques, including building a basic 3D engine, 3D lines, fills and solids, and matrix math.Once you come to grips with the ideas presented here, youll find yourself creating all manner of exciting animations and games! Summary of Contents Part I ActionScripted Animation Basics Ch. 1 Basic Animation Concepts Ch. 2 ActionScript Basics for Animation Ch. 3 Trigonometry Ch. 4 Rendering Techniques Part II Basic Motion Ch. 5 Velocity and Acceleration Ch. 6 Bouncing and Friction Ch. 7 User Interaction: Dragging and Throwing Part III Advanced Motion Ch. 8 Easing and Springs Ch. 9 Collision Detection Ch. 10 Bouncing off Angles Ch. 11 Billiard Ball Physics Ch. 12 Particle Attraction Ch. 13 Forward Kinematics Ch. 14 Inverse Kinematics Part IV Three D Ch. 15 A Basic 3D Engine Ch. 16 3D Lines, Fills, Solids Ch. 17 Advanced 3D: Backface Culling and Lighting Ch. 18 Matrix Math Part V Tips and Tricks Ch. 19 Tips and Tricks

Table of Contents

Foreword xii
About the Author xiii
About the Technical Reviewer xiv
About the Cover Image Designer xv
Acknowledgments xvi
Introduction xvii
PART ONE ACTIONSCRIPTED ANIMATION BASICS
1(98)
Basic Animation Concepts
3(10)
What is animation?
4(1)
Frames and motion
5(2)
Frames as records
6(1)
Programmed frames
7(1)
Dynamic vs. static animation
7(3)
Summary
10(3)
Basics of ActionScript for Animation
13(28)
Basic animation
14(14)
A note on versions
14(1)
Setup
14(1)
Looping
15(4)
Frame loops
19(1)
Clip events
20(3)
Flash MX events and event handlers
23(1)
Listeners
24(1)
Handlers
25(2)
Events for animation
27(1)
Movie clips
28(4)
Movie clip symbols and instances
29(1)
Movie clip creation
29(1)
Duplicating movie clips
29(1)
Attaching movie clips
29(3)
Creating empty movie clips
32(1)
Classes and OOP
32(4)
A basic class
33(1)
Constructors
34(1)
Inheritance
34(1)
A MovieClip subclass
35(1)
User interaction
36(3)
Mouse events
36(1)
Keyboard events
37(1)
Mouse position
38(1)
Key codes
38(1)
Summary
39(2)
Trigonometry for Animation
41(28)
What is trigonometry?
42(1)
Angles
42(5)
Radians and degrees
43(1)
Flash's coordinate system
44(3)
Triangle sides
47(1)
Trig functions
47(6)
Sine
47(2)
Cosine
49(1)
Tangent
50(1)
Arcsine and arccosine
51(1)
Arctangent
51(2)
Rotation
53(2)
Waves
55(5)
Smooth up and down motion
57(1)
Linear vertical motion
58(1)
Pulsing motion
58(1)
Waves with two angles
59(1)
Waves with the drawing API
59(1)
Circles and ellipses
60(2)
Circular movement
60(2)
Elliptical movement
62(1)
Pythagorean Theorem
62(1)
Distance between two points
63(2)
Important formulas in this chapter
65(2)
Summary
67(2)
Rendering Techniques
69(30)
Colors in Flash
70(3)
Using hexadecimal color values
70(1)
Combining colors
71(2)
Extracting component colors
73(1)
The Drawing API
73(14)
Removing drawing with clear
74(1)
Setting line appearance with lineStyle
75(1)
Drawing lines with lineTo and moveTo
75(2)
Drawing curves with curveTo
77(1)
Curving through the control point
78(1)
Creating multiple curves
78(4)
Creating shapes with beginFill and endFill
82(1)
Creating gradient fills with beginGradientFill
83(1)
Specifying the fill type
83(1)
Setting the colors, alphas, and ratios
83(1)
Creating the matrix
84(3)
Color transforms
87(4)
Changing color with the Color object
87(1)
Setting a single color with setRGB
87(1)
Transforming colors with setTransform
88(1)
Changing colors with the ColorTransform object
89(2)
Filters
91(3)
Creating a filter
92(1)
Animating filters
93(1)
Bitmap control
94(3)
Important formulas in this chapter
97(1)
Summary
98(1)
PART TWO BASIC MOTION
99(62)
Velocity and Acceleration
101(22)
Velocity
102(7)
Vectors and velocity
102(2)
Velocity on one axis
104(1)
Velocity on two axes
105(1)
Angular velocity
105(2)
Vector addition
107(1)
A mouse follower
108(1)
Velocity extended
108(1)
Acceleration
109(11)
Acceleration on one axis
110(2)
Acceleration on two axes
112(1)
Gravity as acceleration
113(2)
Angular acceleration
115(1)
A spaceship
116(2)
Ship controls
118(1)
Thrust
119(1)
Important formulas in this chapter
120(1)
Summary
121(2)
Boundaries and Friction
123(24)
Environmental boundaries
124(15)
Setting boundaries
124(2)
Removing objects
126(4)
Regenerating objects
130(2)
Screen wrapping
132(2)
Bouncing
134(5)
Friction
139(5)
Friction, the right way
140(1)
Friction, the easy way
141(1)
Friction applied
142(2)
Important formulas in this chapter
144(1)
Summary
145(2)
User Interaction: Moving Objects Around
147(14)
Pressing and releasing a movie clip
148(2)
Dragging a movie clip
150(6)
Dragging with mouseMove
151(1)
Dragging with startDrag/stopDrag
152(1)
Combining dragging with motion code
152(4)
Throwing
156(3)
Summary
159(2)
PART THREE ADVANCED MOTION
161(162)
Easing and Springing
163(26)
Proportional Motion
164(1)
Easing
164(8)
Simple easing
165(3)
When to stop easing
168(2)
A moving target
170(1)
Easing isn't just for motion
171(1)
Transparency
171(1)
Rotation
171(1)
Colors
172(1)
Advanced easing
172(1)
Springing
172(14)
Springing in one dimension
173(2)
Springing in two dimensions
175(1)
Springing to a moving target
175(1)
So where's the spring?
176(1)
Chaining springs
177(3)
Springing to multiple targets
180(2)
Offsetting the target
182(1)
Attaching multiple objects with springs
183(3)
Important formulas in this chapter
186(1)
Summary
187(2)
Collision Detection
189(22)
Collision detection methods
190(1)
Built-in hitTest
190(6)
Hit testing two movie clips
191(3)
Hit testing a movie clip and a point
194(1)
Hit testing with shapeFlag
195(1)
Summary of hitTest
196(1)
Distance-based collision detection
196(6)
Simple distance-based collision detection
197(2)
Collision-based springing
199(3)
Multiple-object collision detection strategies
202(6)
Basic multiple-object collision detection
202(2)
Multiple-object springing
204(4)
Important formulas in this chapter
208(1)
Summary
208(3)
Coordinate Rotation and Bouncing Off Angles
211(24)
Simple coordinate rotation
212(1)
Advanced coordinate rotation
213(4)
Rotating a single object
214(1)
Rotating multiple objects
215(2)
Bouncing off an angle
217(15)
Performing the rotation
220(2)
Optimizing the code
222(2)
Making it dynamic
224(1)
Fixing the ``falling off the edge'' problem
224(1)
Hit testing
224(1)
Bounds checking
225(1)
Fixing the ``under the line'' problem
226(2)
Bouncing off multiple angles
228(4)
Important formulas in this chapter
232(1)
Summary
232(3)
Billiard Ball Physics
235(28)
Mass
236(1)
Momentum
237(1)
Conservation of momentum
237(23)
Conservation of momentum on one axis
239(2)
Placing the objects
241(1)
Optimizing the code
242(1)
Conservation of momentum on two axes
243(1)
Understanding the theory and strategy
243(4)
Writing the code
247(9)
Adding more objects
256(2)
Solving a potential problem
258(2)
Important formulas in this chapter
260(1)
Summary
261(2)
Particle Attraction and Gravity
263(18)
Particles
264(1)
Gravity
265(5)
Gravitational force
265(3)
Collision detection and reaction
268(1)
Orbiting
269(1)
Springs
270(8)
Gravity vs. springs
270(2)
A springy node garden
272(2)
Nodes with connections
274(2)
Nodes with mass
276(2)
Important formulas in this chapter
278(1)
Summary
278(3)
Forward Kinematics: Making Things Walk
281(24)
Introducing forward and inverse kinematics
282(1)
Getting started programming forward kinematics
283(3)
Moving one segment
283(2)
Moving two segments
285(1)
Automating the process
286(6)
Building a natural walk cycle
287(3)
Making it dynamic
290(2)
Making it really walk
292(10)
Giving it some space
292(1)
Adding gravity
293(1)
Handling the collision
294(2)
Handling the reaction
296(2)
Screen wrapping, revisited
298(4)
Summary
302(3)
Inverse Kinematics: Dragging and Reaching
305(18)
Reaching and dragging single segments
306(2)
Reaching with a single segment
306(1)
Dragging with a single segment
307(1)
Dragging multiple segments
308(2)
Dragging two segments
308(1)
Dragging more segments
309(1)
Reaching with multiple segments
310(7)
Reaching for the mouse
310(4)
Reaching for an object
314(2)
Adding some interaction
316(1)
Using the standard inverse kinematics method
317(5)
Introducing the law of cosines
318(2)
ActionScripting the law of cosines
320(2)
Important formulas in this chapter
322(1)
Summary
322(1)
PART FOUR 3D ANIMATION
323(88)
3D Basics
325(34)
The third dimension and perspective
326(6)
The z axis
326(2)
Perspective
328(1)
The perspective formula
328(1)
Perspective in ActionScript
329(3)
Velocity and acceleration
332(1)
Bouncing
333(5)
Single object bouncing
333(3)
Multiple object bouncing
336(2)
Z-sorting
338(1)
Gravity
338(3)
Wrapping
341(6)
Easing and springing
347(3)
Easing
347(1)
Springing
348(2)
Coordinate rotation
350(5)
Collision detection
355(2)
Important formulas in this chapter
357(1)
Summary
357(2)
3D Lines and Fills
359(28)
Creating points and lines
360(3)
Making shapes
363(4)
Creating 3D fills
367(7)
Using triangles
368(5)
Defining the triangles' colors
373(1)
Modeling 3D solids
374(8)
Modeling a spinning cube
374(3)
Modeling other shapes
377(1)
Pyramid
377(1)
Extruded letter ``A''
378(2)
Cylinder
380(2)
Moving 3D solids
382(3)
Summary
385(2)
Backface Culling and 3D Lighting
387(24)
Backface culling
388(6)
Depth sorting
394(6)
3D lighting
400(10)
Summary
410(1)
PART FIVE ADDITIONAL TECHNIQUES
411(46)
Matrix Math
413(14)
Matrix basics
414(1)
Matrix operations
414(7)
Matrix addition
415(1)
Matrix multiplication
416(1)
Scaling with a matrix
416(1)
Coordinate rotation with a matrix
417(1)
Coding with matrices
418(3)
The Matrix class in Flash 8
421(4)
Summary
425(2)
Tips and Tricks
427(30)
Brownian (random) motion
428(3)
Random distribution
431(7)
Square distribution
431(2)
Circular distribution
433(2)
Biased distribution
435(3)
Interval-and timer-based animation
438(5)
Interval-based animation
439(2)
Timer-based animation
441(2)
Collisions between same-mass objects
443(1)
Integrating sound
444(3)
Useful formulas
447(10)
Chapter 3
447(1)
Chapter 4
448(1)
Chapter 5
449(1)
Chapter 6
449(1)
Chapter 8
450(2)
Chapter 9
452(1)
Chapter 10
452(1)
Chapter 11
453(1)
Chapter 12
453(1)
Chapter 14
454(1)
Chapter 15
454(3)
Index 457

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Rewards Program