
At a Glance
490 Pages
23.5 x 19.05 x 2.52
Paperback
RRP $54.99
$54.75
or 4 interest-free payments of $13.69 with
orAims to ship in 7 to 10 business days
When will this arrive by?
Enter delivery postcode to estimate
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 you 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 Flash's 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, there's no need to worry, even if you're 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. You'll work your way through slowly, from using code to move a single object across the screen to creating complex systems that really push Flash's 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, you'll find yourself creating all manner of exciting animations and games!
Foreword | p. xii |
About the Author | p. xiii |
About the Technical Reviewer | p. xiv |
About the Cover Image Designer | p. xv |
Acknowledgments | p. xvi |
Introduction | p. xvii |
Actionscripted Animation Basics | p. 1 |
Basic Animation Concepts | p. 3 |
What is animation? | p. 4 |
Frames and motion | p. 5 |
Frames as records | p. 6 |
Programmed frames | p. 7 |
Dynamic vs. static animation | p. 7 |
Summary | p. 10 |
Basics of ActionScript for Animation | p. 13 |
Basic animation | p. 14 |
A note on versions | p. 14 |
Setup | p. 14 |
Looping | p. 15 |
Frame loops | p. 19 |
Clip events | p. 20 |
Flash MX events and event handlers | p. 23 |
Listeners | p. 24 |
Handlers | p. 25 |
Events for animation | p. 27 |
Movie clips | p. 28 |
Movie clip symbols and instances | p. 29 |
Movie clip creation | p. 29 |
Duplicating movie clips | p. 29 |
Attaching movie clips | p. 29 |
Creating empty movie clips | p. 32 |
Classes and OOP | p. 32 |
A basic class | p. 33 |
Constructors | p. 34 |
Inheritance | p. 34 |
A MovieClip subclass | p. 35 |
User interaction | p. 36 |
Mouse events | p. 36 |
Keyboard events | p. 37 |
Mouse position | p. 38 |
Key codes | p. 38 |
Summary | p. 39 |
Trigonometry for Animation | p. 41 |
What is trigonometry? | p. 42 |
Angles | p. 42 |
Radians and degrees | p. 43 |
Flash's coordinate system | p. 44 |
Triangle sides | p. 47 |
Trig functions | p. 47 |
Sine | p. 47 |
Cosine | p. 49 |
Tangent | p. 50 |
Arcsine and arccosine | p. 51 |
Arctangent | p. 51 |
Rotation | p. 53 |
Waves | p. 55 |
Smooth up and down motion | p. 57 |
Linear vertical motion | p. 58 |
Pulsing motion | p. 58 |
Waves with two angles | p. 59 |
Waves with the drawing API | p. 59 |
Circles and ellipses | p. 60 |
Circular movement | p. 60 |
Elliptical movement | p. 62 |
Pythagorean Theorem | p. 62 |
Distance between two points | p. 63 |
Important formulas in this chapter | p. 65 |
Summary | p. 67 |
Rendering Techniques | p. 69 |
Colors in Flash | p. 70 |
Using hexadecimal color values | p. 70 |
Combining colors | p. 71 |
Extracting component colors | p. 73 |
The Drawing API | p. 73 |
Removing drawing with clear | p. 74 |
Setting line appearance with lineStyle | p. 75 |
Drawing lines with lineTo and moveTo | p. 75 |
Drawing curves with curveTo | p. 77 |
Curving through the control point | p. 78 |
Creating multiple curves | p. 78 |
Creating shapes with beginFill and endFill | p. 82 |
Creating gradient fills with beginGradientFill | p. 83 |
Specifying the fill type | p. 83 |
Setting the colors, alphas, and ratios | p. 83 |
Creating the matrix | p. 84 |
Color transforms | p. 87 |
Changing color with the Color object | p. 87 |
Setting a single color with setRGB | p. 87 |
Transforming colors with setTransform | p. 88 |
Changing colors with the ColorTransform object | p. 89 |
Filters | p. 91 |
Creating a filter | p. 92 |
Animating filters | p. 93 |
Bitmap control | p. 94 |
Important formulas in this chapter | p. 97 |
Summary | p. 98 |
Basic Motion | p. 99 |
Velocity and Acceleration | p. 101 |
Velocity | p. 102 |
Vectors and velocity | p. 102 |
Velocity on one axis | p. 104 |
Velocity on two axes | p. 105 |
Angular velocity | p. 105 |
Vector addition | p. 107 |
A mouse follower | p. 108 |
Velocity extended | p. 108 |
Acceleration | p. 109 |
Acceleration on one axis | p. 110 |
Acceleration on two axes | p. 112 |
Gravity as acceleration | p. 113 |
Angular acceleration | p. 115 |
A spaceship | p. 116 |
Ship controls | p. 118 |
Thrust | p. 119 |
Important formulas in this chapter | p. 120 |
Summary | p. 121 |
Boundaries and Friction | p. 123 |
Environmental boundaries | p. 124 |
Setting boundaries | p. 124 |
Removing objects | p. 126 |
Regenerating objects | p. 130 |
Screen wrapping | p. 132 |
Bouncing | p. 134 |
Friction | p. 139 |
Friction, the right way | p. 140 |
Friction, the easy way | p. 141 |
Friction applied | p. 142 |
Important formulas in this chapter | p. 144 |
Summary | p. 145 |
User Interaction: Moving Objects Around | p. 147 |
Pressing and releasing a movie clip | p. 148 |
Dragging a movie clip | p. 150 |
Dragging with mouseMove | p. 151 |
Dragging with startDrag/stopDrag | p. 152 |
Combining dragging with motion code | p. 152 |
Throwing | p. 156 |
Summary | p. 159 |
Advanced Motion | p. 161 |
Easing and Springing | p. 163 |
Proportional Motion | p. 164 |
Easing | p. 164 |
Simple easing | p. 165 |
When to stop easing | p. 168 |
A moving target | p. 170 |
Easing isn't just for motion | p. 171 |
Transparency | p. 171 |
Rotation | p. 171 |
Colors | p. 172 |
Advanced easing | p. 172 |
Springing | p. 172 |
Springing in one dimension | p. 173 |
Springing in two dimensions | p. 175 |
Springing to a moving target | p. 175 |
So where's the spring? | p. 176 |
Chaining springs | p. 177 |
Springing to multiple targets | p. 180 |
Offsetting the target | p. 182 |
Attaching multiple objects with springs | p. 183 |
Important formulas in this chapter | p. 186 |
Summary | p. 187 |
Collision Detection | p. 189 |
Collision detection methods | p. 190 |
Built-in hitTest | p. 190 |
Hit testing two movie clips | p. 191 |
Hit testing a movie clip and a point | p. 194 |
Hit testing with shapeFlag | p. 195 |
Summary of hitTest | p. 196 |
Distance-based collision detection | p. 196 |
Simple distance-based collision detection | p. 197 |
Collision-based springing | p. 199 |
Multiple-object collision detection strategies | p. 202 |
Basic multiple-object collision detection | p. 202 |
Multiple-object springing | p. 204 |
Important formulas in this chapter | p. 208 |
Summary | p. 208 |
Coordinate Rotation and Bouncing Off Angles | p. 211 |
Simple coordinate rotation | p. 212 |
Advanced coordinate rotation | p. 213 |
Rotating a single object | p. 214 |
Rotating multiple objects | p. 215 |
Bouncing off an angle | p. 217 |
Performing the rotation | p. 220 |
Optimizing the code | p. 222 |
Making it dynamic | p. 224 |
Fixing the "falling off the edge" problem | p. 224 |
Hit testing | p. 224 |
Bounds checking | p. 225 |
Fixing the "under the line" problem | p. 226 |
Bouncing off multiple angles | p. 228 |
Important formulas in this chapter | p. 232 |
Summary | p. 232 |
Billiard Ball Physics | p. 235 |
Mass | p. 236 |
Momentum | p. 237 |
Conservation of momentum | p. 237 |
Conservation of momentum on one axis | p. 239 |
Placing the objects | p. 241 |
Optimizing the code | p. 242 |
Conservation of momentum on two axes | p. 243 |
Understanding the theory and strategy | p. 243 |
Writing the code | p. 247 |
Adding more objects | p. 256 |
Solving a potential problem | p. 258 |
Important formulas in this chapter | p. 260 |
Summary | p. 261 |
Particle Attraction and Gravity | p. 263 |
Particles | p. 264 |
Gravity | p. 265 |
Gravitational force | p. 265 |
Collision detection and reaction | p. 268 |
Orbiting | p. 269 |
Springs | p. 270 |
Gravity vs. springs | p. 270 |
A springy node garden | p. 272 |
Nodes with connections | p. 274 |
Nodes with mass | p. 276 |
Important formulas in this chapter | p. 278 |
Summary | p. 278 |
Forward Kinematics: Making Things Walk | p. 281 |
Introducing forward and inverse kinematics | p. 282 |
Getting started programming forward kinematics | p. 283 |
Moving one segment | p. 283 |
Moving two segments | p. 285 |
Automating the process | p. 286 |
Building a natural walk cycle | p. 287 |
Making it dynamic | p. 290 |
Making it really walk | p. 292 |
Giving it some space | p. 292 |
Adding gravity | p. 293 |
Handling the collision | p. 294 |
Handling the reaction | p. 296 |
Screen wrapping, revisited | p. 298 |
Summary | p. 302 |
Inverse Kinematics: Dragging and Reaching | p. 305 |
Reaching and dragging single segments | p. 306 |
Reaching with a single segment | p. 306 |
Dragging with a single segment | p. 307 |
Dragging multiple segments | p. 308 |
Dragging two segments | p. 308 |
Dragging more segments | p. 309 |
Reaching with multiple segments | p. 310 |
Reaching for the mouse | p. 310 |
Reaching for an object | p. 314 |
Adding some interaction | p. 316 |
Using the standard inverse kinematics method | p. 317 |
Introducing the law of cosines | p. 318 |
ActionScripting the law of cosines | p. 320 |
Important formulas in this chapter | p. 322 |
Summary | p. 322 |
3D Animation | p. 323 |
3D Basics | p. 325 |
The third dimension and perspective | p. 326 |
The z axis | p. 326 |
Perspective | p. 328 |
The perspective formula | p. 328 |
Perspective in ActionScript | p. 329 |
Velocity and acceleration | p. 332 |
Bouncing | p. 333 |
Single object bouncing | p. 333 |
Multiple object bouncing | p. 336 |
Z-sorting | p. 338 |
Gravity | p. 338 |
Wrapping | p. 341 |
Easing and springing | p. 347 |
Easing | p. 347 |
Springing | p. 348 |
Coordinate rotation | p. 350 |
Collision detection | p. 355 |
Important formulas in this chapter | p. 357 |
Summary | p. 357 |
3D Lines and Fills | p. 359 |
Creating points and lines | p. 360 |
Making shapes | p. 363 |
Creating 3D fills | p. 367 |
Using triangles | p. 368 |
Defining the triangles' colors | p. 373 |
Modeling 3D solids | p. 374 |
Modeling a spinning cube | p. 374 |
Modeling other shapes | p. 377 |
Pyramid | p. 377 |
Extruded letter "A" | p. 378 |
Cylinder | p. 380 |
Moving 3D solids | p. 382 |
Summary | p. 385 |
Backface Culling and 3D Lighting | p. 387 |
Backface culling | p. 388 |
Depth sorting | p. 394 |
3D lighting | p. 400 |
Summary | p. 410 |
Additional Techniques | p. 411 |
Matrix Math | p. 413 |
Matrix basics | p. 414 |
Matrix operations | p. 414 |
Matrix addition | p. 415 |
Matrix multiplication | p. 416 |
Scaling with a matrix | p. 416 |
Coordinate rotation with a matrix | p. 417 |
Coding with matrices | p. 418 |
The Matrix class in Flash 8 | p. 421 |
Summary | p. 425 |
Tips and Tricks | p. 427 |
Brownian (random) motion | p. 428 |
Random distribution | p. 431 |
Square distribution | p. 431 |
Circular distribution | p. 433 |
Biased distribution | p. 435 |
Interval- and timer-based animation | p. 438 |
Interval-based animation | p. 439 |
Timer-based animation | p. 441 |
Collisions between same-mass objects | p. 443 |
Integrating sound | p. 444 |
Useful formulas | p. 447 |
Chapter 3 | p. 447 |
Chapter 4 | p. 448 |
Chapter 5 | p. 449 |
Chapter 6 | p. 449 |
Chapter 8 | p. 450 |
Chapter 9 | p. 452 |
Chapter 10 | p. 452 |
Chapter 11 | p. 453 |
Chapter 12 | p. 453 |
Chapter 14 | p. 454 |
Chapter 15 | p. 454 |
Index | p. 457 |
Table of Contents provided by Ingram. All Rights Reserved. |
ISBN: 9781590595183
ISBN-10: 1590595181
Series: Foundation
Published: 1st October 2005
Format: Paperback
Language: English
Number of Pages: 490
Audience: General Adult
Publisher: Springer Nature B.V.
Country of Publication: US
Dimensions (cm): 23.5 x 19.05 x 2.52
Weight (kg): 0.82
Shipping
Standard Shipping | Express Shipping | |
---|---|---|
Metro postcodes: | $9.99 | $14.95 |
Regional postcodes: | $9.99 | $14.95 |
Rural postcodes: | $9.99 | $14.95 |
How to return your order
At Booktopia, we offer hassle-free returns in accordance with our returns policy. If you wish to return an item, please get in touch with Booktopia Customer Care.
Additional postage charges may be applicable.
Defective items
If there is a problem with any of the items received for your order then the Booktopia Customer Care team is ready to assist you.
For more info please visit our Help Centre.
You Can Find This Book In
This product is categorised by
- Non-FictionComputing & I.T.Graphical & Digital Media ApplicationsDigital Animation
- Non-FictionComputing & I.T.Computer Programming & Software DevelopmentWeb Programming
- Non-FictionComputing & I.T.Computer Programming & Software DevelopmentSoftware Engineering
- Non-FictionComputing & I.T.Graphical & Digital Media ApplicationsIllustration & Drawing Software