mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
48 lines
1.2 KiB
HTML
48 lines
1.2 KiB
HTML
<html>
|
|
<head>
|
|
<link href="gui.css" media="screen" rel="stylesheet" type="text/css" />
|
|
<link href="demo.css" media="screen" rel="stylesheet" type="text/css" />
|
|
<script type="text/javascript" src="controller.js"></script>
|
|
<script type="text/javascript" src="gui.js"></script>
|
|
<script id="demo" type="text/javascript">var controllableObject =
|
|
{
|
|
numberProperty: 20,
|
|
constrainedNum: 0,
|
|
textProperty: "a string",
|
|
booleanProperty: false,
|
|
functionProperty: function() {
|
|
alert("I am a function!");
|
|
}
|
|
};
|
|
|
|
window.onload = function() {
|
|
|
|
GUI.start();
|
|
GUI.show(); // collapsed by default
|
|
|
|
// Creates a number box
|
|
GUI.add(controllableObject, "numberProperty");
|
|
|
|
// Creates a slider (min, max)
|
|
GUI.add(controllableObject, "constrainedNum", -100, 100).setName("customName");
|
|
|
|
// Creates a text field
|
|
GUI.add(controllableObject, "textProperty");
|
|
|
|
// Creates a checkbox
|
|
GUI.add(controllableObject, "booleanProperty");
|
|
|
|
// Creates a button
|
|
GUI.add(controllableObject, "functionProperty");
|
|
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<pre id="demo-pre">
|
|
<script type="text/javascript">
|
|
document.getElementById("demo-pre").innerHTML = document.getElementById("demo").innerHTML;
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html> |