Help with some patterns

Hi there :slight_smile: I’m wondering if anyone would be willing and able to create some patterns for me?

I’ve designed this digital stained glass window and many of the patterns that are in the repository are great, but they don’t fully take advantage of the layout.

I’d love to see something that radiates out from the center, or that has the center rotate one direction, then the next layer out in the other direction, and so forth.

Hi @nickbeaulieu,
That looks pretty sweet! To get the most out of it, you’ll want a 2D pixel map. Then you can use a bunch of the 2D patterns and get some sweet effects.

Check out this post for a simple click mapper:

Once you have a pixel map, you can get things like radius and angle (and some patterns do this already) and use that instead of index/pixelCount to upgrade many patterns.

There’s a pattern on the pattern sharing site with some utility functions for getting angle/radius (assuming centered in a piece) called “angle and radius from coordinates”

Here’s a post with some more background and examples of how these might be used:

Once you get a 2D pixel map installed, I would humbly suggest you try out my clock pattern :slight_smile:

As an example of upgrading a pattern I took millipede and have it use angle. you can see the 1D render and render2D side by side to see how it was modified:

speed = 20
legs = 10

export function beforeRender(delta) {
  t1 = time(1 / speed)
  t2 = time(2 / speed)
}

export function render(index) {
  h = index / pixelCount 
  h += (index / pixelCount + t2) * legs / 2 % .5
  v = wave(h + t2)
  v = v * v // Gamma correction
  hsv(h, 1, v)
}

export function render2D(index, x, y) {
  //use angle around a center point instead of distance on a strip
  h = (1 + atan2(x - .5, y - .5)/PI2) * .5 
  h += (h + t2) * legs / 2 % .5
  v = wave(h + t2)
  v = v * v // Gamma correction
  hsv(h, 1, v)
}

I’ve also uploaded a fancier version with controls to the sharing site.

1 Like

Thanks! I’ve got a 2D pixel map set up already, so the 2D patterns work nicely. Not exactly what I’ve described here, but for the most part they’re great.

I’ll take a look at the links you posted. Thanks :slight_smile: