mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-29 14:19:01 -05:00
add delta control to demo gui
This commit is contained in:
parent
6e302a8724
commit
442814bccf
1 changed files with 16 additions and 0 deletions
|
@ -41,6 +41,22 @@ var demo = function(examples, isDev) {
|
|||
document.title = 'Matter.js Demo' + (isDev ? ' ・ Dev' : '');
|
||||
|
||||
if (isDev) {
|
||||
// add delta control
|
||||
Matter.Common.chainPathAfter(MatterTools, 'Gui.create', function() {
|
||||
this.datGui.__folders["Engine"]
|
||||
.add(demo, "delta", 0, 1000 / 55)
|
||||
.onChange(function() {
|
||||
var runner = demo.example.instance.runner;
|
||||
runner.delta = demo.delta;
|
||||
})
|
||||
.step(0.001)
|
||||
.listen();
|
||||
});
|
||||
|
||||
Matter.after('Runner.create', function() {
|
||||
demo.delta = this.delta;
|
||||
});
|
||||
|
||||
// add compare button
|
||||
var buttonSource = demo.dom.buttonSource,
|
||||
buttonCompare = buttonSource.cloneNode(true);
|
||||
|
|
Loading…
Reference in a new issue