Hello all,
I am attempting to create an LED pattern that happens once and only once. The closest I can get it are producing inconsistent results. My ultimate goal is to make a 3d printed version of Nakatomi Plaza (the building Die Hard took place in) and re-create flashbangs, gun fire, and explosions in the building. As a result, I do not need repeating light patterns but more of a ‘one and done’ type of effect.
Thank you.
you would be surprised what you can think of when you step away for a minute and really think about the issue at hand! Here is the basic solution I found: "var countdown = .5; // Countdown in seconds
var brightness = 1; // Initial brightness
var FrontDoor = [0, 1, 2, 3, 4]; // Array holding the indices for FrontDoor LEDs
export function beforeRender(delta) {
if (countdown > 0) {
countdown -= delta / 1000; // Decrease countdown by elapsed time in seconds
} else {
brightness = 0; // Set brightness to 0 to turn off FrontDoor LEDs
}
}
export function render(index) {
var isFrontDoor = false;
for (var i = 0; i < FrontDoor.length; i++) {
if (index == FrontDoor[i]) {
isFrontDoor = true;
break;
}
}
if (isFrontDoor) {
rgb(1 * brightness, 0, 0); // Apply brightness multiplier only to FrontDoor LEDs
} else {
rgb(0, 0, 0); // Ensure other LEDs are always off
}
}
"
1 Like