Closed gsimone closed 3 years ago
hey @gsimone, why did you close this issue? Is there any way to use monitors? Thanks. Nice work so far!
Reopening! Pretty sure Gianmarco was already thinking of the new magic api he has in mind, but first things first!
Hey @CptCompiler we had them working in the previous API, but weren't too happy about it. Monitors are special in that they have to be imperatively set by the user, original API was something like:
const [monitor,setMonitor] = createMonitor(...)
useTweaks(monitor)
// your imperative code
setMonitor(4)
Opinions?
@dbismut proposes using a ref, which we feel is more react-like
const ref = useRef(0)
useTweaks("Monitor", {
...otherTweaks,
...makeMonitor(ref, "MyMonitorName", ...settings))
}
// setting the ref value to update the monitor
useFrame(({ clock }) => { ref.current = Math.sin(clock.getElapsedTime()) })
Thanks for your fast replies, guys!
Hmm... I think I would prefer refs as well. Sounds good.
If you want you can give some feedback in PR #35
Yeah... thank you very much. Keep up the good work! 🎉
API for monitors, maybe a fn that hides constants or something