Take for example, modifying the opacity of an object. Unlike other properties, such as left
or top, opacity takes a value only between 0 and 1 and isn??™t a pixel-based measurement. Therefore,
you have to start adding in special cases, checking for property values being passed in
and planning for them.
CHAPTER 6 n VISUAL EFFECTS 142
You??™ll now take a look at a few of the different animation options available to use through
the following libraries:
??? Script.aculo.us
??? jQuery
??? Mootools
Script.aculo.us
The Script.aculo.us library extends Prototype to offer up a number of animation possibilities
through its core and combination effect components.
Similar to the animation object you developed previously, there is a base effect class,
called Effect.Base, from which all the other effect classes extend. It??™s slightly different in that
the base class doesn??™t actually change the value of any object, but is instead left up to the child
classes. The base class handles all the timing, which enables each child class to do what it does
best and account for the special scenarios (such as the opacity issue).
The core effects are as follows:
??? Effect.Opacity: Changes the opacity of an element, enabling it to fade in or out
??? Effect.Move:Moves an element around the page
??? Effect.Scale: Scales the element up by resizing its dimensions and the font size of the
content within
??? Effect.
Pages:
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214