HTML and CSS Reference
In-Depth Information
But a coded animation isn't necessarily interactive. You can take an object and, using code, move it from a
particular position across the screen. Each time the animation is played, the same code runs, causing the
same movement. This is an example of what we'll call a static animation. Each frame, from start to finish,
is predefined. Similar to a movie, you're watching a predetermined sequence of images that do not change
on another viewing.
But what if you create an object, and again, using code, determine a random point to place it and a
random direction and speed to move it? Now, each time you play the animation, something different
happens. Or, what happens if, when the animation starts, you determine the time of day and month of the
year, and use that data to create a scene—a winter morning, a summer afternoon, visually distinct images
depending on the date the program is run?
Or, maybe you have some factors in your animation that change using input from the keyboard and mouse
while it runs. This enables the user to interact with the objects on the screen, and about as far from static
as you can get.
Perhaps the most interesting aspect of dynamic animation, and the focus of this topic, is the application of
real-world mathematics and physics principles to objects in the animation. You're not limited to moving an
object in some random direction; you can also give it some gravity, so that as it moves, it falls down. When
it hits the “ground,” it bounces, but not as high as it started out. Then it eventually settles down and just sits
there. You can also add some user interaction, enabling the user to “pick up” the object with the mouse or
move it around with the keyboard. As the user throws the object around, she gets the feeling of handling a
physical object.
With this kind of animation, the user is no longer a passive recipient of a sequence of frames that plays
out, but has entered an environment you created. You can construct a world that models the physical
constraints of your own, providing a more realistic experience, or, you can completely disregard such
worldly confines. As the programmer, you are free to express your vision as you see fit. These are the joys
of creative coding; by offloading tasks to the computer and having a constantly updating visual display, you
can create rich scenes that involve the viewer in a way no medium in human history has been able to do
before. How long will viewers stay there? They will remain as long as the environment keeps them
interested. The more they interact with it, the more likely they'll come back for more.
Summary
In this opening chapter, the basics of animation theory have been summarized. We build on the concepts
of frames and dynamism to create motion and interactivity in our animations.
In the following chapters, we examine the mathematical elements of movement and build a collection of
tools that you'll incorporate into your programmed animations to create motion, and include lessons on
how to use them. What you create with these tools is entirely your decision. The most obvious applications
of the techniques in this topic are for game creation. Games are essentially interactive animations with
some goals for players to achieve. But this is not simply a game-programming book. These techniques are
applicable to a wide range of animated projects—from navigational systems, to advertisements, to
educational applications, and to interactive art.
 
Search WWH ::




Custom Search