commit:be2b2f1a9583a8d0874de5bfde8d9b0ab67d964a
author:Chip Black
committer:Chip Black
date:Wed Sep 16 01:34:08 2009 -0500
parents:089f31d8e476edaaadb17b6ffdbfb5fdc54e8ed9
Add documentation
diff --git a/doc/Bytex64.FX.frag b/doc/Bytex64.FX.frag
line changes: +113/-0
index 0000000..11d91eb
--- /dev/null
+++ b/doc/Bytex64.FX.frag
@@ -0,0 +1,113 @@
+$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

diff --git a/doc/Bytex64.FX.html b/doc/Bytex64.FX.html
line changes: +120/-0
index 0000000..d5815c5
--- /dev/null
+++ b/doc/Bytex64.FX.html
@@ -0,0 +1,120 @@
+<html>
+<head>
+<title>Bytex64.FX</title>
+<link rel="stylesheet" href="doc.css">
+</head>
+<body>
+<h1>Bytex64.FX</h1>
+
+<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>
+
+
+</body>
+</html>

diff --git a/doc/Makefile b/doc/Makefile
line changes: +6/-0
index 0000000..172c3b6
--- /dev/null
+++ b/doc/Makefile
@@ -0,0 +1,6 @@
+DOCS = Bytex64.FX
+
+all: $(addsuffix .html,$(DOCS))
+
+%.html: %.frag generate.pl
+	perl generate.pl $(basename $<) >$@

diff --git a/doc/doc.css b/doc/doc.css
line changes: +20/-0
index 0000000..2fb46ff
--- /dev/null
+++ b/doc/doc.css
@@ -0,0 +1,20 @@
+body {
+	font: 12pt serif;
+	margin: 8pt;
+}
+
+h1 {
+	background-color: black;
+	color: white;
+	margin: -8pt;
+	padding: 8pt;
+	font-family: sans-serif;
+}
+
+dt {
+	font-style: italic;
+}
+
+emph {
+	font-style: italic;
+}

diff --git a/doc/generate.pl b/doc/generate.pl
line changes: +19/-0
index 0000000..7c6d20d
--- /dev/null
+++ b/doc/generate.pl
@@ -0,0 +1,19 @@
+#!/usr/bin/perl
+
+my $name = shift;
+
+eval `cat $name.frag`;
+
+print <<PROTO;
+<html>
+<head>
+<title>$TITLE</title>
+<link rel="stylesheet" href="doc.css">
+</head>
+<body>
+<h1>$TITLE</h1>
+
+$CONTENT
+</body>
+</html>
+PROTO