# Cylinder pixel map

**URL:** <https://forum.electromage.com/t/cylinder-pixel-map/641>\
**Category:** Patterns and Code\
**Created:** [October 14, 2020, 8:53pm UTC](https://forum.electromage.com/t/cylinder-pixel-map/641 "2020-10-14T20:53:42Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jeff](https://forum.electromage.com/user_avatar/forum.electromage.com/jeff/32/3473_2.png) [@jeff](https://forum.electromage.com/u/jeff)\
**Post date:** [October 14, 2020, 9:57pm UTC](https://forum.electromage.com/t/cylinder-pixel-map/641/2 "2020-10-14T21:57:50Z")

</div>

Sure! This map just builds off the pre-loaded “Ring” example.

I assumed each layered ring is wired sequentially, and that pixel index 0 is in the bottom layer.

```javascript
function (pixelCount) {
  var map = [];
  var layers = 18;
  var pixPerRing = 17;
  for (layer = 0; layer < layers; layer++) {
    for (i = 0; i < pixPerRing; i++) {
      c = i / pixPerRing * Math.PI * 2
      map.push([Math.cos(c), Math.sin(c), layer])
    }
  }
  return map
}

```

 ![Pixelblaze 2020-10-14 14-56-52](https://forum.electromage.com/uploads/default/original/1X/b18e2c6961b8a548a8b69a657209b38364f14d14.png)

---

_[View the full topic](https://forum.electromage.com/t/cylinder-pixel-map/641)._
