From 6c21734b0fe144508773cd4c990b5dbabb89e685 Mon Sep 17 00:00:00 2001 From: George Michael Brower Date: Mon, 18 Apr 2011 15:40:26 -0700 Subject: [PATCH] min, max and step as methods for ControllerNumber --- index.html | 394 ++++++++++++++++++++---------------- src/DAT/ControllerNumber.js | 55 ++++- src/dat/gui.js | 56 ++--- 3 files changed, 302 insertions(+), 203 deletions(-) diff --git a/index.html b/index.html index c6e9bb2..f9f5bbf 100644 --- a/index.html +++ b/index.html @@ -2,9 +2,9 @@ dat.gui - - - + + + @@ -14,119 +14,125 @@ - + - + -
- - -
+
- -
+ +
-

dat.gui flag

+ +
-

dat.gui is a lightweight controller library for JavaScript. It allows you to easily manipulate variables and fire functions on the fly.

+

dat.gui flag +

- + + +

Basic Usage

 <script type="text/javascript" src="gui.min.js"></script>
 <script type="text/javascript">
@@ -141,11 +147,10 @@ window.onload = function() {
    gui.add(fizzyText, "message");
 
    // Sliders with min + max
-   gui.add(fizzyText, "maxSize", 0.5, 7);
-   gui.add(fizzyText, "growthSpeed", 0.01, 1);
-   gui.add(fizzyText, "speed", 0.1, 2);
+   gui.add(fizzyText, "maxSize").min(0.5).max(7);
+   gui.add(fizzyText, "growthSpeed").min(0.01).max(1).step(0.05);
+   gui.add(fizzyText, "speed", 0.1, 2, 0.05); // shorthand for min/max/step
 
-   // Sliders with min, max and increment.
    gui.add(fizzyText, "noiseStrength", 10, 100, 5);
 
    // Boolean checkbox
@@ -159,37 +164,48 @@ window.onload = function() {
 </script>
 
-
    -
  • dat.gui will infer the type of the property you're trying to add
    - (based on its initial value) and create the corresponding control.
  • +
      +
    • dat.gui will infer the type of the property you're trying + to add
      + (based on its initial value) and create the corresponding control. +
    • -
    • The properties must be public, i.e. defined by this.prop = value.
    • -
    - - - -