Hi all,
I’m trying to modify the KITT patterns in 2 ways: I would like it to be one-directional, and also keep the background pixels lit. The second part is ok, I asked how to do it long ago and got all the help I needed, but now I’m stuck in how to make it one-directional. If I remove the part that reverses direction, when the leader resets all the less of the strip flash at full intensity. I know it’s the last bit of the code that’s responsible for this, but I can’t really decipher it so any help would be much appreciated:)
leader = 0
direction = 1
pixels = array(pixelCount)
export function sliderHue(v) {
Hue = (v);
}
export function sliderSpeed(v) {
speed = (v / 12 +.01);
}
//export var fade
export function sliderFade(v) {
fade = ((1-v) /300 +0.00016 );
}
export function beforeRender(delta) {
lastLeader = floor(leader)
leader += delta * speed
if (leader >= pixelCount) {
leader = 0
}
up = lastLeader < leader
for (i = lastLeader; i != floor(leader); up ? i++ : i-- ) pixels[i] = 1
for (i = 0; i < pixelCount; i++) {
pixels[i] -= delta * fade
pixels[i] = max(0.4, pixels[i])
}
}
export function render(index) {
v = pixels[index]
v = v * v * v
h = (v > 0.002) ? 0 : 1
hsv(Hue, 1, (h == 0) ? v : 0.5)
}