/doc/Bytex64.FX.frag
$TITLE = 'Bytex64.FX'; $CONTENT = <<'EOD'; <h2>Concepts</h2> <p>The Bytex64.FX library provides simple routines to execute timed manipulations of display elements. At the core of this is the <emph>effect function</emph>, 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 <code>p</code>) ranges from 0.0 to 1.0 over the lifetime of the effect. A simple effect function might look like: <pre> function fadeIn(p) { elem.style.opacity = p; } </pre> <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) <p>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. <p>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 <code>Bytex64.FX.run()</code> manages your effect function, allowing the effect to last a variable amount of time. <h2>Class Variables</h2> <dd> <dt>Bytex64.FX.version</dt> <dd>The version of the library, in case you want to check for a specific version</dd> <dt>Bytex64.FX.updateInterval</dt> <dd>specifies the effect update interval in milliseconds</li> </dd> <h2>Global Functions</h2> <dl> <dt>Bytex64.FX.run(fx, secs)</dt> <dd>Runs a given effect function <code>fx</code> for <code>secs</code> seconds. This happens asynchronously, so if you want to wait for it to complete, be sure that this logic happens in your effect function.</dd> <dt>Bytex64.FX.create(fx, secs)</dt> <dd>Returns a function that executes the given effect function for the given duration. A convenience function for creating shortcut functions.</dd> <dt>Bytex64.FX.fadeIn(elem)</dt> <dd>Accepts a DOM element, then returns a function that fades the element in when called.</dd> <dt>Bytex64.FX.fadeOut(elem)</dt> <dd>Like fadeIn, but fades the element out</dd> </dl> <h2>Classes</h2> <h3>Bytex64.FX.Effect(fx, secs)</h3> <p>A class containing a single effect function and its duration. <code>Fx</code> is the effect function, and <code>secs</code> is the duration in seconds. <h4>Members</h4> <dl> <dt>run()</dt> <dd>Run the effect</dd> </dl> <h3>Bytex64.FX.ParallelEffect(fxs, secs)</h3> <p>Like Effect, but executes several effects in parallel. <code>Fxs</code> is a list of effect functions, and <code>secs</code> is the duration in seconds. <h4>Members</h4> <dl> <dt>run()</dt> <dd>Run the effect</dd> </dl> <h3>Bytex64.FX.EffectChain(chain)</h3> <p>EffectChain executes a series of Effects or ParallelEffects (they may be mixed freely). <code>Chain</code> is a list of Effect and/or ParallelEffect objects. This can be used to compose complex effect sequences. <h4>Members</h4> <dl> <dt>current</dt> <dd>The index of the current executing effect in the chain</dd> <dt>run()</dt> <dd>Run the sequence of Effects</dd> </dl> EOD