Using a regulated current source to light them, wire the LEDs in series and short out the segment which you want to be dark.
simulate this circuit – Schematic created using CircuitLab
You can possibly use a buck-boost converter to make the 30V if you don't already have a suitable voltage.
Here's a simple way to build one using a LM2596S module:
- Remove the potentiometer and both large capacitors
- Connect one of the salvaged capacitors between +in and +out (positive to +in), and fit a 1uF ceramic capacitor where the output capacitor was.
- Connect a 100 ohm resistor from the -output to the centre potentiometer terminal.
Modified in this way, it will create a negative voltage on the -out terminals and act as a 12.5mA current sink at the centre potentiometer terminal (with source at +out) if power is applied between +in and +out.
or a XL6009 buck-boost module can be modified. this time just remove the potentiometer and add a 100 ohm resistor, connec 3-30V to the nirmal input terminals and connect the LED string to the output and resistor.