Mapping and preview issues

I could be missing something. I have two led lines going out from my expansion board. They are going in opposite directions but want them to be continuous for 2D animations. An image of the setup is shown below.


Here is the code I am using for the map. Which works great and looks perfect live, but the preview gives the opposite effect in that it is how the live strands use to look prior to the map. Is there a way to fix this. It seems like it could be good to put in a negative number for the led count so it could start from the end and go backwards. Any help would be great.

function (pixelCount) {
width = 33
y = 0
var map = []
for (i = 0; i < pixelCount; i++) {
if(i<width)
x = width-i
else
x = i
map.push([x, y])
}
return map
}

That is normal, the gradient on the preview on the Mapper tab is purely based on the pixel index, not the mapped coordinate. The pulsing animation should follow the wiring / pixel index as well.

Many 1D only patterns won’t use the pixel map though, so may need a quick conversion to 2D. Generally you can do this by changing the render(index) to render2D(index, x, y) and replace index/pixelCount with x in the code.

At some point in the future Pixelblaze will add support for a proper render1D or perhaps adding x to render, along with 1D mapper/preview support. For now though, you are on the right track using a 2D map.

1 Like