/doc/Bytex64.FX.html
Bytex64.FX
Bytex64.FX
Concepts
The Bytex64.FX library provides simple routines to execute timed
manipulations of display elements. At the core of this is the
effect function , a simple function that accepts a floating
point value, and uses that value to perform some visual manipulation.
The value (which I typically refer to as p ) ranges from 0.0
to 1.0 over the lifetime of the effect. A simple effect function might
look like:
function fadeIn(p) {
elem.style.opacity = p;
}
(Aside: There is nothing in the library that specifically requires you
to manipulate visual elements. The library could just as easily be used
to execute any other timed operation, but that is outside the scope of
its intent)
So as p progresses from 0.0 to 1.0, the opacity of elem (which is
assumed to be a DOM element) changes from 0.0 to 1.0, and the element
fades in.
I may have implied with that statement that this happens in some
linear fashion. The reality is that effect functions are called
periodically over a given time interval. A simple engine in
Bytex64.FX.run() manages your effect function, allowing the
effect to last a variable amount of time.
Class Variables
Bytex64.FX.version
The version of the library, in case you want to check for a
specific version
Bytex64.FX.updateInterval
specifies the effect update interval in milliseconds
Global Functions
Bytex64.FX.run(fx, secs)
Runs a given effect function fx for secs
seconds. This happens asynchronously, so if you want to wait for it
to complete, be sure that this logic happens in your effect
function.
Bytex64.FX.create(fx, secs)
Returns a function that executes the given effect function for the
given duration. A convenience function for creating shortcut
functions.
Bytex64.FX.fadeIn(elem)
Accepts a DOM element, then returns a function that fades the
element in when called.
Bytex64.FX.fadeOut(elem)
Like fadeIn, but fades the element out
Classes
Bytex64.FX.Effect(fx, secs)
A class containing a single effect function and its duration.
Fx is the effect function, and secs is the
duration in seconds.
Members
run()
Run the effect
Bytex64.FX.ParallelEffect(fxs, secs)
Like Effect, but executes several effects in parallel.
Fxs is a list of effect functions, and secs is
the duration in seconds.
Members
run()
Run the effect
Bytex64.FX.EffectChain(chain)
EffectChain executes a series of Effects or ParallelEffects (they may
be mixed freely). Chain is a list of Effect and/or
ParallelEffect objects. This can be used to compose complex effect
sequences.
Members
current
The index of the current executing effect in the chain
run()
Run the sequence of Effects