@mogmaar, your project is going to look fantastic!!
Iād just wire the rings in the way that makes it easiest to build. Itās conceptually pretty easy to change where a ring starts in the mapper ā you just change the rotation of the LED coordinates for the ring.
Hereās a version of the mapper that lets you shift the origin of each ring by an arbitrary number of pixels. Just enter the value you need, positive or negative, for each ring into the origin_shift
array.
It is set up to shift ring 0 by 30 pixels. Iāve included a very short pattern at the bottom of this message to show where the rings start ā make your changes to the mapper, then switch to the editor window to see how it looks.
To get rid of the shift for a ring, just set the ringās origin_shift value back to 0. (and please forgive my slightly clunky mods to @sorcererās very elegant javascript.)
function (pixelCount) {
radius = Math.sqrt(2)
map = []
strands = [
[-1, 0, 0, 0, 1, 1 ],
[ 1, 0, 0, 0,-1, 1 ],
[ 0,-1, 0, 1, 0, 1 ],
[ 0, 1, 0,-1, 0, 1 ],
[ 0, 0,-1, 1, 1, 0 ],
[ 0, 0, 1,-1, 1, 0 ],
]
leds_per_strand = 200
// number of pixels to shift the origin of each ring
// can be positive or negative.
origin_shift = [30,0,0,0,0,0]
strands.forEach((strand,index) => {
cx = strand[0]
cy = strand[1]
cz = strand[2]
ux = strand[3]
uy = strand[4]
uz = strand[5]
// shift the origin the ring by some number of pixels
// number of pixels
theta = (origin_shift[index] / leds_per_strand) * (Math.PI * 2)
for (led = 0; led < leds_per_strand; led++) {
angle = theta+(led / leds_per_strand) * (Math.PI * 2)
x = Math.cos(angle) * radius
y = Math.sin(angle) * radius
map.push([
cx - x * cx + y * ux,
cy - x * cy + y * uy,
cz - x * cz + y * uz,
])
}
})
return map
}
Short pattern to show you where each ring starts:
var pixPerRing = pixelCount / 6;
var halfRing = pixPerRing / 2;
export function beforeRender(delta) {
}
export function render(index) {
h = .618 * floor(index/pixPerRing);
v = 1-abs(halfRing-(index % pixPerRing))/halfRing;
hsv(h, 1, v < 0.02)
}