Help creating a couple patterns

Hi there,

I’ve just built this light for a friend. I’m looking for some help creating a pattern that radiates out from the center. Something that you could vary the speed and colours of.

I’d also love a similar pattern that is sound reactive.

Would anyone be able to help?

1 Like

Where the straight segments join, are they wired in series?

Have you got the pixels’ positions mapped (on the Map) tab?

If so, any 2D radial pattern will work. Here are a few from the pattern library to try:

3D Pulsing Sphere.epe (4.8 KB)
Animated Asterisks 2D.epe (10.7 KB)
Radial Rainbow.epe (5.0 KB)
Radial Rainbow 2D (Sound Reactive).epe (5.7 KB)

There are also a few people who have built icosahedrons and nanoleaf-style lights; if you search the forum you might find that they have done patterns that follow the topography of the shapes and do interesting things with the symmetry of the corner vertices.

1 Like

I agree with @pixie , first question is the wiring, it looks like the data path is not forked but unsure at first glance. That’s a must for sure.

Mapping is the critical roll, I mean critical piece.
It should be easy to define locations for each led, and map it. Then any 2D pattern will work.

What you really need is a pattern that makes it look like a 3D icosahedron with point light sources flying around it. A good 3D map and a dot product should do it!

Yep, it’s all mapped, and the lights are wired in series. No forks

1 Like

For those curious, this is my map:

Click to view
[
[190,830],
[225,833],
[262,833],
[303,836],
[338,836],
[376,838],
[415,838],
[453,839],
[490,840],
[529,841],
[567,842],
[607,847],
[645,845],
[684,847],
[722,850],
[744,820],
[723,784],
[707,752],
[687,718],
[671,685],
[649,651],
[631,616],
[613,582],
[594,549],
[576,516],
[557,483],
[540,449],
[522,413],
[504,382],
[486,347],
[446,349],
[425,383],
[403,417],
[386,452],
[365,484],
[345,516],
[325,548],
[306,581],
[287,613],
[267,644],
[246,678],
[226,709],
[206,742],
[187,773],
[167,806],
[178,858],
[204,886],
[228,915],
[253,942],
[279,971],
[305,1000],
[329,1029],
[353,1057],
[379,1087],
[402,1117],
[425,1145],
[469,1139],
[497,1112],
[522,1085],
[552,1057],
[576,1032],
[604,1006],
[630,980],
[657,953],
[684,926],
[713,898],
[739,873],
[773,809],
[787,771],
[800,736],
[813,699],
[827,663],
[840,625],
[853,589],
[866,552],
[879,513],
[893,477],
[906,438],
[876,409],
[838,401],
[799,389],
[762,381],
[724,374],
[681,363],
[646,352],
[610,344],
[570,336],
[530,327],
[497,319],
[446,313],
[409,321],
[371,331],
[333,337],
[296,346],
[259,354],
[220,361],
[185,371],
[150,377],
[110,386],
[76,392],
[43,398],
[43,450],
[56,485],
[66,519],
[77,557],
[87,595],
[98,630],
[106,666],
[116,705],
[128,740],
[137,776],
[126,845],
[93,861],
[58,880],
[51,918],
[83,938],
[114,957],
[147,977],
[180,998],
[211,1017],
[242,1040],
[274,1059],
[306,1080],
[339,1100],
[370,1119],
[514,1132],
[548,1113],
[581,1096],
[617,1077],
[648,1062],
[683,1042],
[719,1023],
[749,1006],
[784,987],
[820,969],
[855,950],
[889,932],
[855,912],
[822,891],
[787,870],
[897,889],
[898,850],
[902,813],
[901,775],
[903,734],
[904,698],
[905,657],
[906,618],
[907,582],
[910,540],
[912,500],
[855,381],
[820,359],
[785,341],
[753,320],
[718,301],
[686,282],
[653,263],
[619,242],
[586,221],
[552,203],
[521,183],
[486,162],
[472,195],
[469,233],
[467,272],
[439,172],
[403,190],
[372,209],
[339,227],
[306,246],
[273,264],
[238,283],
[204,303],
[174,322],
[139,340],
[112,358],
[29,484],
[29,521],
[29,559],
[27,597],
[27,634],
[26,672],
[26,710],
[25,749],
[26,786],
[26,820],
[24,857],
[22,895]
]

Looks like your wiring spirals from the center outwards through the three rings:

Mapper

so linear patterns with left-to-right movement could also be interesting:

Meteor Shower.epe (6.1 KB)
spin cycle.epe (5.8 KB)
sound - rays.epe (17.0 KB)

2 Likes

Try this code! It provides a way to turn on any linear segment individually, and program a sequence. It’s a little hard to do this without your LEDs in front of me, so there might be bugs.

Code to turn on specific segments
// For https://forum.electromage.com/t/help-creating-a-couple-patterns/1796
// Count of pixels in each segment, based on wiring order
var segments =
  [
    15, // 0: Bottom inner triangle side
    15, // 1: Right inner triangle side
    15, // 2: Left inner triangle side
    11, // 3: Lower left middle layer
    11, // 4: Lower right middle layer
    11, // 5: Right middle layer
    11, // 6: Top right middle layer
    12, // 7: Top left middler layer
    10, // 8: Left middle layer
    3, // 9: Lower left short radial
    11, // 10: Lower left outer
    12, // 11: Lower right outer
    3, // 12: Lower right short radial
    11, // 13: Right outer vertical
    12, // 14: Top right outer
    3, // 15: Top short radial
    11, // 16: Top left outer
    12 // 17: Left outer vertical
  ]

// If segments = [1, 3, 1], segmentsCumulative = [1, 4, 5]
var segmentsCumulative = array(segments.length)
var accumulator = 0
segments.mapTo(segmentsCumulative, (value, index, array) => { 
  accumulator += value
  return accumulator
})

// Cache a map for every pixel index, what segment index is it a  part of
var indexToSegment = array(pixelCount)
indexToSegment.mutate((value, index, array) => {
  for (i = 0; i < segmentsCumulative.length; i++)
    if (index < segmentsCumulative[i]) return i
})

// Each entry (a "step") has a list of the segments that should be on
var sequence = [
  [-1], // All off
  [-1], // For two steps
  [0],
  [0, 1],
  [0, 1, 2], // Inner triangle is lit - pause here
  [0, 1, 2],
  [0, 1, 2, 4,],
  [0, 1, 2, 4, 5],
  [0, 1, 2, 4, 5, 6],
  [0, 1, 2, 4, 5, 6, 7],
  [0, 1, 2, 4, 5, 6, 7, 8],
  [0, 1, 2, 4, 5, 6, 7, 8, 3], // Two inner layers lit - pause here
  [0, 1, 2, 4, 5, 6, 7, 8, 3], 
  [0, 1, 2, 4, 5, 6, 7, 8, 3, 9, 12, 15], // Add all short radials
  [0, 1, 2, 4, 5, 6, 7, 8, 3, 9, 12, 15, 10, 11, 13, 14, 16, 17], // Add all outer
  [0, 1, 2, 4, 5, 6, 7, 8, 3, 9, 12, 15, 10, 11, 13, 14, 16, 17]
]

var steps = sequence.length
var stepDuration = .5 // Time spent in each sequence step, in seconds
export var step = 0 // Which step in the sequence we're in
var segmentsOn = array(segments.length) // Array containing the segment indices that should be on

export function beforeRender(delta) {
  step = floor(steps * time(steps * stepDuration / 65.535))
  segmentsOn = sequence[step % steps]
}

var thisSegment = 0

export function render(index) {
  thisSegment = indexToSegment[index]
  var v = includes(segmentsOn, thisSegment)
  hsv(0, 1, v)
}

var includeTestVal
function includes(arr, val) {
  includeTestVal = val // Scope issue with .reduce()
  var instances = v = arr.reduce((a, v) => a + (includeTestVal == v), 0)
  return instances >= 1
}

(Sidenote for @wizard - Look how easy this is with array literals!! Thanks!!)

Nick - If possible, can you post a video of your project running this? My favorite way to do that is to upload an unlisted YouTube video, then copy the link into your reply here.

3 Likes

oh that works really cool! I’ll take a video and upload it now.

3 Likes

I edited it a little

// Each entry (a “step”) has a list of the segments that should be on
var sequence = [
[-1], // All off
[-1], // For two steps
[0],
[0, 1],
[0, 1, 2], // Inner triangle is lit - pause here
[0, 1, 2],
[0, 1, 2, 3,],
[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4, 5],
[0, 1, 2, 3, 4, 5, 6],
[0, 1, 2, 3, 4, 5, 6, 7],
[0, 1, 2, 3, 4, 5, 6, 7, 8], // Two inner layers lit - pause here
[0, 1, 2, 3, 4, 5, 6, 7, 8],
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 15], // Add all short radials
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 15, 10, 11, 13, 14, 16, 17], // Add all outer
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 15, 10, 11, 13, 14, 16, 17]
]

you’ll notice that sometimes it jumps and lights 2 segments at once.

1 Like

Thank you! The rainbow radial is perfect and just what I was looking for :smiley: I’d tried to load that one earlier and I couldn’t get it to load, but seems to work fine now. :slight_smile:

1 Like

Thanks for your help, guys! I was able to figure it out. :slight_smile: I created an edit of the Fast Pulse 3D, and several different variants:

1 Like