Continuous knobs

I need to control color hue in my application and would like to implement a rotary widget that can spin continuously and report degrees. I feel certain this must be a common use case but I’m not seeing how to do this in either the documentation or here on the forum. Thanks in advance for any advice.

You could do something like that with a knob widget with

  • angle to 360
  • snap to true
  • range to {min: 0, max: 360}

Works like a charm. Knew it would be straightforward but hadn’t understood that snap applied here. Thanks @jean-emmanuel.

@erictheise may be useful to share your piece of code with others to help the community.
Cheers

1 Like

If anyone arrives here looking for a current (v.1.9.11) way to have a continuous knob, the solution is to use "mode": "snap". Been away from my project for a year and it took me a while to figure out this updated solution.

2 Likes

@jean-emmanuel, it seems that since v1.17.0 I'm no longer able to rotate CCW past 0 or CW past 360°. The session file at GitHub issue #793 about default values should display this behavior, too.

I've reinstalled v1.16.6 and my knobs' previous & expected behavior has been restored. I noted in v1.17.0, and in the docs and release notes, that there's a circular mode but if that's what I should be using it wasn't clear what parameters I needed.

I'm afraid I had to break that to fix another problem with knobs (knob: `sensitivity` and ctrl+drag preserve `circular` mode behavior · jean-emmanuel/open-stage-control@fb621a6 · GitHub), but in next version the old behavior will be available again with an extra mode called snap-alt. Alternatively you could use the encoder widget that exposes its angle via scripting (using locals.angle).

1 Like