From 5feacca44cb016f3a3e532ed055d03308d37d1e6 Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Sun, 12 Jan 2025 11:56:10 -0600 Subject: [PATCH] tween callback --- scripts/prosperon.js | 2 +- scripts/render.js | 2 +- scripts/tween.js | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/prosperon.js b/scripts/prosperon.js index 49aa9e3a..64a98273 100644 --- a/scripts/prosperon.js +++ b/scripts/prosperon.js @@ -37,7 +37,7 @@ globalThis.sim = {}; sim.mode = "play"; sim.play = function () { this.mode = "play"; - os.reindex_static(); +// os.reindex_static(); game.all_objects(o => { if (!o._started) { o._started = true; diff --git a/scripts/render.js b/scripts/render.js index eccf1bc4..40131227 100644 --- a/scripts/render.js +++ b/scripts/render.js @@ -1249,7 +1249,7 @@ var imgui_fn = function imgui_fn() { // imgui.endframe(render._main); }; -//if (dmon) dmon.watch('.'); +if (dmon) dmon.watch('.'); function dmon_cb(e) { diff --git a/scripts/tween.js b/scripts/tween.js index c1e86581..1fb13b92 100644 --- a/scripts/tween.js +++ b/scripts/tween.js @@ -112,7 +112,7 @@ Ease.elastic = { Ease.elastic.c4 = (2 * Math.PI) / 3; Ease.elastic.c5 = (2 * Math.PI) / 4.5; -var tween = function (from, to, time, fn) { +var tween = function (from, to, time, fn, cb) { var start = profile.now() var update = function tween_update(dt) { @@ -121,6 +121,7 @@ var tween = function (from, to, time, fn) { if (elapsed >= time) { fn(to); stop(); + cb?.(); } }; var stop = Register.update.register(update);