Adding light reflection effect on knobs.

What instructions do I need to invoke in the knob structure to add the light reflection effect?

I know there is the istruction shadow->opacity=x; that enable or disable the shadow under a knob.

I have looked some codes and VCV Rack API, but couldn’t find the instruction to add the effect mentioned before, can anyone help me find it? many thanks

Are you talking about the diagonal hourglass-shaped highlight upper left to lower right here?

image

There is no API to add it. That’s just a part of the knob’s background svg. The foreground svg has the indicator line, and a dark ring. Only the foreground svg of a knob is rotated.

To see how these are constructed: take a look at the Small Round Black Knob:

Resources:

background: Rack/res/ComponentLibrary/RoundSmallBlackKnob_bg.svg
foreground: Rack/res/ComponentLibrary/RoundSmallBlackKnob.svg

And for the code behind the knobs, see the Rack source code:

Rack\include\componentlibrary.hpp (and the base classes these inherit from).

If you’re building modules, I highly recommend cloning the Rack source (and a few other plugins – at least Fundamental) and building it yourself along with your plugin, rather than using the SDK. This makes it easy to step through the Rack source code to learn how everything works. Since the documentation is so, ah, minimal, shall we say, you need to read the source to understand how things work.

2 Likes