New 2D Patterns: Spinwheel & Matrix Waterfall

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! :slight_smile: ) 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);
}

Videos below:

6 Likes

Whoa, spinwheel 2D is my new favorite pattern! Super happy to have a Matrix for the Matrix too!

Wow. The Matrix! And we control some aspects of this One! Nice.
Also a fan of Spinwheel. Amazing what can be done here!

1 Like

Spinwheel looks awesome but I get a no valid render function found on a pb3. Any ideas?

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.

Oh man I had put in my map but it was still stuck on ring instead of matrix. Here it is.

2 Likes

@array, just out of curiousity, give this one a try and see how it looks!

Line Dance
// Twisting line effect - basic idea from a PC screensaver I saw
// long, long ago.  No idea where.
// Re-imagined to be uniquely Pixelblaze-y
//
// 08/03/2021 - ZRanger1

var timebase = 0;
var t1;
var zoom;
export var speed = 7;

translate(-0.5,-0.5);

export function sliderSpeed(v) {
  speed = 1+(9*v);
}

export function beforeRender(delta) {
  timebase = (timebase + delta/1000) % 1000;
  t1 = timebase * speed;
  zoom = wave(time(0.075));
}

export function render2D(index,x,y) {
  var h,b,radius,theta;  
  
  radius = 1.7-hypot(x,y)*2.4;
  theta = radius * radius * sin(radius + t1);
  x = (cos(theta) * x) - (sin(theta)* y);

  b = 1-wave(x*4.6*zoom);
  h = (x * zoom)+ zoom + theta/PI2;
  hsv(h,1,b*b);
}

It’s something I’m playing with this afternoon. Haven’t got it perfect yet, but it seems like it might go well with that display. :slight_smile:

1 Like

Looks cool to me!

3 Likes

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…

For sure I wish we had a platform where people could just go plug in their patterns online and view it on someone else’s display.

2 Likes

Sounds like a job for Pixel Teleporter! :smiley:

4 Likes

This reminds me of https://youtu.be/06yKM2rubaw?t=27

2 Likes

actually, that seems like a neat pattern itself… now I want to do that one…

1 Like

Maybe try slowing it down a bit?