Hi Everyone and Happy Holidays!
I am looking for the ready to go lighting pattern for Hanukkah
for 300 LEDs WS2812 strip
Something like very slow blending of white/blue colors will work.
Of course, better ideas are very welcome.
Hi Everyone and Happy Holidays!
I am looking for the ready to go lighting pattern for Hanukkah
for 300 LEDs WS2812 strip
Something like very slow blending of white/blue colors will work.
Of course, better ideas are very welcome.
Hi @Vitaliy, there’s a pattern that looks really good in a 1D application(not just 1D) called Oasis made by @zranger1
It’s on page 6 on the “Get Patterns” page.
Thank you very much.
I will check it out.
Hey @Vitaliy -
Here are two I use. They’re both adapted from one I found in the pattern library a while ago (I forget which one).
The first is just blue with white sparkles.
// Adapted from a pattern by Parker Holley
//note: real h/360 (real h has range of 0-360) = xmas tree h (has range of 0-1). in other words, divide real hue by 360 to get a usable hue value for this code.
export function prob(factorOf100) {// a probability function. will return true 1 in factorOf100 times.
var rngGoal = 1000/factorOf100//rng = Random Number Generator
if(random(rngGoal) >= rngGoal-0.5){// no built in rounding function, so we subtract our goal by 0.5 and check for >= to pseudo-round up
return(true)//if our randomly generated number was equal (rounded) to our set goal, proceed
} else {
return(false)
}
}
var runs = array(pixelCount);// used to track our "hook" to see how long stars have been twinkling. don't touch.
//editable vars! feel free to play with these
var runsToBlue = 50// how many runs to get back to fullbright blue after being set to white. defaults to 50. set higher for longer lasting star twinkles
var twinkleChance = 1// odds (twinkleChance/100) that a light will twinkle. defaults to 1. set higher for twinklier.
export function render(index) {
h = 0.66//blue hue
s = 1//fullbright blue saturation
if(runs[index] < runsToBlue){//catch the hook if white
s = 0+((1/runsToBlue)*runs[index])// make us slightly less white (transition slowly back to blue)
runs[index]++// increment our hook for the next time around
} else if(prob(twinkleChance)) {// if you hit those 1-in-twinkleChance odds...
s = 0// set us to 0 saturation (white)
runs[index] = 1// set up a hook for the next time around
}
v = 1//value. don't touch
hsv(h, s, v)
}
The second is similar, but it adds 8 candles being “lit”. Hopefully it looks right on 300 pixels - I run this on a 240-pixel long 60/m strip.
export function prob(n) {// a probability function. will return true 1 in n times.
return random(1) <= 1/n
}
var runsToBlue = 20
var runs = array(pixelCount);// used to track our "hook" to see how long stars have been twinkling. don't touch.
for (i=0; i < pixelCount; i++) {runs[i]=runsToBlue}
//editable vars! feel free to play with these
var twinkleChance = 700 // odds (1-in-twinkleChance) that a light will twinkle.
export function beforeRender(delta) {
t1 = time(8 / 65.536)
t2 = time(20 / 65.536)
}
export function render(index) {
render2D(index, index / pixelCount, index / pixelCount)
}
export function render2D(index, x, y) {
w = wave(((index - 12)/pixelCount) * 16)
m = square(((index - 12)/pixelCount) * 8, .25)
w = w*w*w*w*w*w
w *= m
s = 1
if(runs[index] < runsToBlue){//catch the hook if white
s = (runs[index]/runsToBlue)// make us slightly less white (transition slowly back to blue)
runs[index]++ // increment our hook for the next time around
v=(1-s)
} else if(prob(twinkleChance)) {// if you hit those 1-in-twinkleChance odds...
s = 0 // set us to 0 saturation (white)
runs[index] = 0 // set up a hook for the next time around
}
if (w > 0.01 && t2 > y) {
h = 0.03
v = s < 1 ? 1 : w
} else {
h = 0.66
v = 0.01
}
hsv(h, sqrt(s), v)
}
Hi Jeff,
Thank you very much.
Both patterns are working and looks good.
I will let my wife to pick one or maybe cycle them.