mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
ec87369a6e
example shows how UndefinedController works
34 lines
779 B
HTML
34 lines
779 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
</head>
|
|
|
|
<body>
|
|
<script type="text/javascript" src="build/dat.gui.min.js"></script>
|
|
<script type="text/javascript">
|
|
var obj = {
|
|
x: undefined,
|
|
y: undefined,
|
|
timer: 2.0
|
|
};
|
|
var gui = new dat.GUI();
|
|
gui.add(obj, 'timer').min(0).max(obj.timer).listen();
|
|
gui.add(obj, 'x').listen();
|
|
var y = gui.add(obj, 'y');
|
|
var interval = setInterval(function () {
|
|
obj.timer -= 0.1;
|
|
if (obj.timer <= 0) {
|
|
clearInterval(interval);
|
|
obj.x = "Not Undefined!";
|
|
obj.y = 1;
|
|
obj.timer = 0;
|
|
y.updateDisplay();
|
|
}
|
|
}, 100);
|
|
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|