From 442814bccf7269606c3187a5fdbb83abdacf7cc2 Mon Sep 17 00:00:00 2001 From: liabru Date: Sun, 17 Mar 2024 11:20:16 +0000 Subject: [PATCH] add delta control to demo gui --- demo/src/Demo.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/demo/src/Demo.js b/demo/src/Demo.js index 39609c4..83981ac 100644 --- a/demo/src/Demo.js +++ b/demo/src/Demo.js @@ -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);