mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
135 lines
5.1 KiB
HTML
135 lines
5.1 KiB
HTML
<!doctype html>
|
|
<head>
|
|
<title>GUI-DAT</title>
|
|
|
|
<link rel="icon" type="image/gif" href="demo/assets/favicon.gif">
|
|
|
|
<link href="gui.css" media="screen" rel="stylesheet" type="text/css" />
|
|
<link href="demo/demo.css" media="screen" rel="stylesheet" type="text/css" />
|
|
<!-- <script type="text/javascript" src="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js"></script>-->
|
|
|
|
<script type="text/javascript" src="gui.js"></script>
|
|
<script type="text/javascript" src="controllers/slider.js"></script>
|
|
<script type="text/javascript" src="controllers/controller.js"></script>
|
|
<script type="text/javascript" src="controllers/controller.string.js"></script>
|
|
<script type="text/javascript" src="controllers/controller.number.js"></script>
|
|
<script type="text/javascript" src="controllers/controller.boolean.js"></script>
|
|
<script type="text/javascript" src="controllers/controller.function.js"></script>
|
|
<script type="text/javascript" src="demo/demo.js"></script>
|
|
<script type="text/javascript">
|
|
var controllableObject =
|
|
{
|
|
numberProperty: 20,
|
|
constrainedNum: 0,
|
|
notchedNum: 240,
|
|
pageTitle: "gui-dat",
|
|
anotherTextProperty: "another string",
|
|
booleanProperty: false,
|
|
anotherBooleanProperty: false,
|
|
functionProperty: function() {
|
|
alert("I am a function!");
|
|
}
|
|
};
|
|
|
|
window.onload = function() {
|
|
|
|
var testDisplay = new DynamicText("gui-dat", 600, 300, 160);
|
|
|
|
// prettyPrint();
|
|
|
|
GUI.start();
|
|
|
|
// Creates a number box
|
|
GUI.add(testDisplay, "minSize", 0, 1);
|
|
|
|
// Creates a number box
|
|
GUI.add(testDisplay, "maxSize", 1, 5);
|
|
|
|
// Creates a slider (min, max)
|
|
GUI.add(testDisplay, "growthSpeed", 0.01, 0.5);
|
|
|
|
// Creates a text field
|
|
GUI.add(testDisplay, "message");
|
|
|
|
// Creates a checkbox
|
|
GUI.add(controllableObject, "booleanProperty");
|
|
|
|
// Creates a button
|
|
GUI.add(controllableObject, "functionProperty")
|
|
.setName("Fire a Function");
|
|
|
|
};
|
|
|
|
var _gaq = _gaq || [];
|
|
_gaq.push(['_setAccount', 'UA-20996084-1']);
|
|
_gaq.push(['_trackPageview']);
|
|
|
|
(function() {
|
|
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
|
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
|
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
|
})();
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<h1><a href = "http://twitter.com/guidat"><img src = "demo/assets/favicon.gif" border = "0" alt = "GUI-DAT flag" /></a><span id = "helvetica-demo"></span></h1>
|
|
|
|
<div id = "helvetica-test"></div>
|
|
<p>
|
|
<strong>gui-dat</strong> is a lightweight controller library for JavaScript. It allows you to easily manipulate variables and fire functions on the fly.
|
|
</p>
|
|
|
|
<p>• <a href="#"><strong>Download the minified source</strong></a> <small>[2.3kb]</small><br/>
|
|
• <a href="http://github.com/jonobr1/GUI-DAT">Contribute on GitHub!</a></p>
|
|
|
|
<h2>Basic Usage</h2>
|
|
|
|
<pre id="demo-pre" class="prettyprint">
|
|
<script type="text/javascript" src="gui.min.js"></script>
|
|
<script type="text/javascript">
|
|
|
|
var controllableObject =
|
|
{
|
|
numberProperty: 20,
|
|
constrainedNum: 0,
|
|
notchedNum: 240,
|
|
textProperty: "a string",
|
|
anotherTextProperty: "another string",
|
|
booleanProperty: false,
|
|
anotherBooleanProperty: false,
|
|
functionProperty: function() {
|
|
alert("I am a function!");
|
|
}
|
|
};
|
|
|
|
window.onload = function() {
|
|
|
|
GUI.start();
|
|
|
|
// Creates a number box
|
|
GUI.add(controllableObject, "numberProperty");
|
|
|
|
// Creates a slider (min, max)
|
|
GUI.add(controllableObject, "constrainedNum", -100, 100)
|
|
|
|
// Creates a slider with notches
|
|
GUI.add(controllableObject, "notchedNum", 0, 800, 100)
|
|
|
|
// Creates a text field
|
|
GUI.add(controllableObject, "textProperty");
|
|
|
|
// Creates a checkbox
|
|
GUI.add(controllableObject, "booleanProperty");
|
|
|
|
// Creates a button
|
|
GUI.add(controllableObject, "functionProperty")
|
|
.setName("Fire a Function");
|
|
|
|
};
|
|
|
|
</script></pre>
|
|
<footer>
|
|
By <a href="http://georgemichaelbrower.com/">George Michael Brower</a>, <a href="http://jonobr1.com/">Jono Brandel</a>, and <a href="http://github.com/jonobr1/GUI-DAT">you</a>.
|
|
</footer>
|
|
</body>
|
|
</html> |