I’ve uploaded a couple of new patterns to the library. These are the first products of playing around with how much work I can actually get done in render. (A lot! ) They’re small, fast and resolution independent. Written for Pixelblaze 3, but will run on PB2 with minor changes.
Spinwheel2D (click for source)
/*
Spinwheel 2D
Colorful, flowerlike radial spinner.
Yet another example of the complex and unpredictible things
that happen when you combine a few simple functions.
7/09/21 JEM(zranger1)
*/
var t1,t2;
var speed = 6;
translate(-0.5,-0.5);
export function beforeRender(delta) {
t1 = time(.2) * (-PI * wave(time(0.1)));
t2 = wave(time(.2)) * speed;
}
export function render2D(index,x,y) {
var arX = (atan2(x,y)+t1*30);
var arY = (hypot(x,y)+t2);
var phi = floor(arY) / PI2;
phi += (phi == 0) * 0.618;
arX = frac(arX);
arY = frac(arY);
var h = (.1/(arX*arX+arY*arY) * .19) * phi;
hsv(t1+(x*y)+h, 1-h, h);
}
Matrix Green Waterfall 2D (click for source)
/*
Basic green "The Matrix"-style waterfall display adapted for
2D LED displays.
Not a perfect reproduction, but captures the feel pretty well,
and the code is small and fast enough to be usable as a background
or a texture in another pattern.
7/15/21 JEM(zranger1)
*/
var speed = 20;
var hue = 0.3333;
// You may want to adjust wavebase for seriously non-rectangular
// displays. Half the number of x axis pixels is a good place
// to start.
var waveBase = (sqrt(pixelCount) / 2);
// uncomment mod() function for pixelblaze 2
//function mod(dividend, divisor) {
// var r = dividend % divisor;
// return (r > 0) != (divisor > 0) ? r + divisor : r;
//}
export function sliderSpeed(v) {
speed = floor(50 * v);
}
export function beforeRender(delta) {
t1 = speed*(time(.25)+0.02);
w = waveBase + (0.5*time(.3))
}
export function render2D(index,x,y) {
var v = mod(y-t1,wave(x*w)); v = v * v;
hsv(hue, 1-((v > 0.8)/12), v);
}
Do you have a 2d pixel map installed? That function only has a render2D implemented, so will only work if there is a pixelmap with 2 dimensions. If you have a matrix there are examples to help you get a map.
Thanks for trying it out! This is turning into one of those “problem” patterns that needs a little more time to bake. It’s definitely colorful and interesting, but is also just a little on the visually disturbing side. I don’t want to make anybody fall over sideways…