Page 1 of 2

Bitmap knob arc

PostPosted: Mon Jun 15, 2020 7:41 pm
by k brown
Is there a way to limit/define the arc of rotation of a bitmap knob, without altering the Drag XY input floats; in other words limiting the visual arc while retaining it's 0-1 float output.

Re: Bitmap knob arc

PostPosted: Tue Jun 16, 2020 9:58 am
by adamszabo
Yes, there is the start angle and sweep angle, you can change in the arc module

Re: Bitmap knob arc

PostPosted: Tue Jun 16, 2020 10:03 am
by k brown
In the old Vector knobs, yes; but I've yet to find a Bitmap knob with an arc module in it, that's why I'm askin'.

Re: Bitmap knob arc

PostPosted: Tue Jun 16, 2020 12:38 pm
by trogluddite
You can do it in principle, but I don't think I've ever seen it done.

Most bitmap knobs use a "strip" of animation frames where the first frame represents the graphics for the "zero" output, the last frame represents the "one" output, and the frame index is just linearly interpolated in between. But that's just the most simple method - there's nothing to stop you from using any maths you like to map the 0..1 range to animation frame indexes.

Usually, there aren't any animation frames for the knob pointing downwards, as they wouldn't be used. But if you had frames covering the full circle, you could use modulus 360 degree maths to allow completely arbitrary arc limits for each control.

Re: Bitmap knob arc

PostPosted: Tue Jun 16, 2020 4:00 pm
by k brown
Setting different values for the Drag Y works fine for creating a short arc (and green maths to restore the output range to 0-1); the hangup is getting it stepped. With Y changed to say 0.25 to 0.75, you get a nice, centered ~100 degree arc, but now the step greens don't work. The whole reason for wanting a short arc knob is to make a selector switch with say, four positions. Must be a way to math it up in the right place to get steps, with 0.25 to 0.75 Y range, no?

Re: Bitmap knob arc

PostPosted: Tue Jun 16, 2020 5:45 pm
by tulamide
Working with angles is not as scaring as it might seem.

Getting position from angle on unit circle, add radius and you can draw your own arc:
Code: Select all
x = radius * cos(angle)
y = radius * sin(angle)


The opposite is the function atan2, a variation of the arcus tangens:
Code: Select all
angle = atan2(x, y)

Re: Bitmap knob arc

PostPosted: Fri Jun 19, 2020 10:35 pm
by k brown
Can anyone offer a solution for a knob that's not code-based - you know, a bitmap knob full of greens, not a Ruby one.

Re: Bitmap knob arc

PostPosted: Sat Jun 20, 2020 5:32 am
by adamszabo
There is the Arc module which is not code based, you can easily add an arc to any existing knob.

Re: Bitmap knob arc

PostPosted: Sat Jun 20, 2020 6:54 am
by k brown
You mean the GUI Arc? - that just draws a line doesn't it?; nothing to do with the rotation angle of the knob, much less create steps within the defined arc of rotation.

Maybe I need to restate my original question more fully/clearly:

I have a bitmap (old-style greens-based, not Ruby) knob; has the usual what is it - 270 degrees rotation. I want it to have only about 90 degrees of rotation for use as a selector switch, like a hardware rotary switch. Within that 90 degree arc, I want it have say four steps. This is all easy-peasy with the old SM Vector knobs; everything you need is already in there.

Like I said, I can get the angle of rotation I want by different values for the Drag Y prim min/max inputs; I just can't figure out how to then get steps within that new arc. The Step module in the knob no longer does it's thing, with the Drag Y values changed.

Re: Bitmap knob arc

PostPosted: Sat Jun 20, 2020 9:38 am
by adamszabo
I still dont really understand it. Is this what you mean? The arc only goes about 90 degrees and not the full angle of the knob. You can change this to whatever you like.