updated index to reflect the new listen() and onChange() functionality

This commit is contained in:
jonobr1 2011-01-28 20:22:05 -07:00
parent ebf5294ee5
commit d3effd0e8a
2 changed files with 5 additions and 5 deletions

View File

@ -9,7 +9,7 @@ var Controller = function() {
return this; return this;
} }
this.setWatched = function() { this.listen = function() {
this.parent.watchController(this); this.parent.watchController(this);
return this; return this;
} }

View File

@ -46,7 +46,7 @@
gui.add(fizzyText, "displayOutline"); gui.add(fizzyText, "displayOutline");
// Watches a property // Watches a property
gui.add(fizzyText, "framesRendered").setWatched(); gui.add(fizzyText, "framesRendered").listen();
// Fires a function called "explode" // Fires a function called "explode"
gui.add(fizzyText, "explode").setName("Explode!"); // Specify a custom name. gui.add(fizzyText, "explode").setName("Explode!"); // Specify a custom name.
@ -94,7 +94,7 @@ window.onload = function() {
gui.add(fizzyText, "displayOutline"); gui.add(fizzyText, "displayOutline");
// Watches a property // Watches a property
gui.add(fizzyText, "framesRendered").setWatched(); gui.add(fizzyText, "framesRendered").listen();
// Fires a function called "explode" // Fires a function called "explode"
gui.add(fizzyText, "explode").setName("Explode!"); // Specify a custom name. gui.add(fizzyText, "explode").setName("Explode!"); // Specify a custom name.
@ -108,7 +108,7 @@ window.onload = function() {
<li>The properties must be public, i.e. defined by <code><strong>this</strong>.prop = value</code>.</li> <li>The properties must be public, i.e. defined by <code><strong>this</strong>.prop = value</code>.</li>
</ul> </ul>
<!-- <hr/> <hr/>
<h2>Monitor variable changes <em>outside</em> of the GUI</h2> <h2>Monitor variable changes <em>outside</em> of the GUI</h2>
<p>Let's say you have a variable that changes by itself from time to time. If you'd like the GUI to reflect those changes, use the <code>listen()</code> method.</p> <p>Let's say you have a variable that changes by itself from time to time. If you'd like the GUI to reflect those changes, use the <code>listen()</code> method.</p>
<pre class="prettyprint">GUI.add(obj, "propName").listen();</pre> <pre class="prettyprint">GUI.add(obj, "propName").listen();</pre>
@ -116,7 +116,7 @@ window.onload = function() {
<h2>Fire a function when someone uses a control</h2> <h2>Fire a function when someone uses a control</h2>
<pre class="prettyprint">GUI.add(obj, "propName").onChange(function(n) { <pre class="prettyprint">GUI.add(obj, "propName").onChange(function(n) {
alert("You changed me to " + n); alert("You changed me to " + n);
});</pre> --> });</pre>
<footer> <footer>
Initiated by <a href="http://georgemichaelbrower.com/">George Michael Brower</a> and <a href="http://jonobr1.com/">Jono Brandel</a> of the Data Arts Team, Google Creative Lab. Initiated by <a href="http://georgemichaelbrower.com/">George Michael Brower</a> and <a href="http://jonobr1.com/">Jono Brandel</a> of the Data Arts Team, Google Creative Lab.