Flash Hacks. 100 Industrial-Strength Tips & Tools Free Open Book

Flash Hacks. 100 Industrial-Strength Tips & Tools

Previous Section  < Day Day Up >  Next Section

Hack 31 Hacking The Matrix

figs/moderate.gif figs/hack31.gif

Quickly re-create the famous falling green text effect from The Matrix.

Suppose we want to make a quick, nonscripted version of the green letter waterfall effect from The Matrix film trilogy. This effect consists of lots of randomly falling, reversed Katakana characters (see http://japanese.about.com/library/weekly/aa052103a.htm for details on Katakana).

The first symbol, named text, is a simple three-keyframe timeline, as shown in Figure 4-8.

Figure 4-8. A three-keyframe timeline for our text symbol
figs/flhk_0408.gif


The three keyframes display the three static text fields shown in Figure 4-9. Although this is a very repetitive animation cycle, nobody will notice because it happens so fast.

Figure 4-9. Three static text fields to be used as the basis for our animation
figs/flhk_0409.gif


The Matrix waterfall effect consists of lots of these text streams falling randomly down the screen over time. To create truly random falling text, we have to do the whole thing with scripts (and judging by a quick look at the online Flash community: (a) not everyone knows how to do this, and (b) a lot of people want to create a Matrix waterfall effect but assume you need to know scripting to do it).

Well, we can't create a truly random animation with just prewritten tweens, but the one presented here repeats only once every 14,535,931 frames (about every two weeks assuming 12 fps), which might as well be random.

The way I did it was to create five tween animations, each within its own movie clip. Each movie clip consists of the text clip falling downward, as shown in Figure 4-10.

Figure 4-10. Movie clip tweened animation showing text falling downward
figs/flhk_0410.gif


The difference between the five tweens is that each is a different number of frames long. Movie clip waterfall19 lasts 19 frames, and waterfall37 is a similar animation lasting 37 frames. The five tweens' names are shown in the Library in Figure 4-11.

Figure 4-11. The Library showing movie clip symbols with prime-numbered frame lengths
figs/flhk_0411.gif


Figure 4-12 [Hack #30] 19 23 29 31 37 frames must elapse before the effect repeats (a rather long period of time).

Figure 4-12. A three-frame sequence of the final Matrix animation
figs/flhk_0412.gif


You'll have to wait a considerable time before the animation repeats if you enjoy a distinct déjà vu feeling. If you are a fan of the first film in the series, you know that déjà vu is a very bad thing and is best avoided, but you'll probably want to add "waterfall" audio to more closely re-create the effect from The Matrix.

Final Thoughts

It's common to watch even a commercially successful animated feature film and see repetitive animation cycles. The main character could be driving down a road, and you will notice that the same combination of scrolling treeline, suburban houses, and parked cars seems to crop up suspiciously regularly. The fact that the same kids are playing in the front garden of every 56th house kinda gives the game away. The reason this has to happen, even in big-budget productions, is that animation is costly, and any time saving that can be made will be made. You don't want to give the game away easily though, and the prime number hack allows you to hide individual animation cycle repetitions by combining them in a way that they do not produce an overall animation that is also extremely repetitive. With increasingly realistic computer-generated effects, even real-life scenes repeat themselves. For example, the crowd in the Washington, D.C. scene in Forrest Gump was really a small tile of people repeated many times. In the movie, The Truman Show, the occupants of the fake town even repeat their movements regularly (cars circle the block, etc.), something which the title character (played by Jim Carrey) comments on.

Back in math class you probably thought prime numbers were only for rocket scientists. Now you know even Tom and Jerry have to use them.

Funny how things work out.

    Previous Section  < Day Day Up >  Next Section
    Index: [SYMBOL][A][B][C][D][E][F][G][H][I][J][L][M][N][O][P][Q][R][S][T][U][V][W][X][Z]


         Main Menu
    Flash Hacks
    Table of Contents
    Copyright
    Credits
    Foreword
    Preface
    Chapter 1. Visual Effects
    Chapter 2. Color Effects
    Chapter 3. Drawing and Masking
    Chapter 4. Animation
    Hacks #26-34
    Hack 26 Smooth Scripted Motion
    Hack 27 Time-Controlled Movement
    Hack 28 Quick, Bandwidth-Efficient Character Animation
    Hack 29 alt-Flash: Motion Graphics Alternatives
    Hack 30 Deja New Animations
    Hack 31 Hacking The Matrix
    Hack 32 Computer-Generated Character Animation
    Hack 33 Particle Effects
    Hack 34 Shape Tweening Complex Shapes
    Chapter 5. 3D and Physics
    Chapter 6. Text
    Chapter 7. Sound
    Chapter 8. User Interface Elements
    Chapter 9. Performance and Optimization
    Chapter 10. ActionScript
    Chapter 11. Browser Integration
    Chapter 12. Security
    Colophon
    Index


    More Books
    PHP Hacks
    Processing Xml With Java - A Guide To Sax, Dom, Jdom, Jaxp, And Trax
    The Koran (Holy Qur'an)
    Macromedia Flash 8 Bible
    Search Engine Optimization for Dummies
    YouTube Traffic
    PHP 5 for Dummies
    Harry Potter and The Chamber of Secrets
    Harry Potter and the Sorcerer's Stone
    The Pilgrim's Progress
    Wireless Hacks
    Flash Hacks. 100 Industrial-Strength Tips & Tools
    PayPal Hacks. 100 Industrial-Strength Tips and Tools
    Amazon Hacks
    Pdf Hacks
    The Da Vinci Code
    Google Hacks
    The Holy Bible
    Windows XP For Dummies
    Harry Potter and the Half-Blood Prince
    Seo Book
    Upgrading and Repairing Networks
    Macromedia Dreamweaver 8 UNLEASHED
    Windows XP Annoyances
    Windows XP Hacks
    Microsoft Windows XP Power Toolkit
    Teach Yourself MS Office In 24Hours
    iPod & iTunes Missing Manual
    PC Hacks 100 Industrial-Strength Tips and Tools
    PC Overclocking, Optimization, and Tuning - 2th Edition
    PC Hardware In A Nutshell 3rd Edition
    PC Hardware in a Nutshell, 2nd Edition
    Upgrading and Repairing PCs
    Google for Dummies
    MySQL Cookbook
    Teach Yourself Macromedia Flash 8 In 24 Hours
    PHP CookBook
    Sams Teach Yourself JavaScript in 24 Hours
    PHP5 Manual
    Free Games Paper Airplanes
    500 Juegos Gratis 500 Giochi Gratis 500 Jeux Gratuits 500 Jogos Gratis 500 Kostenlose Spiele