Pixelbits

Hi, I'm @jasonlong. I'm trying to make a small creative coding sketch every day(ish) to learn new things. All code is available in the GitHub repo.

Random arc grid inspired by the way more awesome Is this art? project by James Mellers.

<script type="text/paperscript" canvas="canvas-0012">
  view.element.style.backgroundColor = '#85144b';
  arcSize = view.size.height / 12;

  // Start with a circle...
  var arc = new Path.Circle(new Point(100, 70), arcSize);

  // And trim it down to a quarter circle.
  arc.removeSegment(3);
  arc.segments[0].handleIn.y = 0;
  arc.segments[1].handleOut.x = 0;
  arc.segments[2].handleIn.x = 0;
  arc.segments[2].handleOut.y = 0;
  arc.segments[2].point.x = 100;
  arc.fillColor = '#ffffff';

  for (y=0; y<10; y++) {
    for (x=0; x<10; x++) {
      newArc = arc.clone();
      newArc.position = new Point(x*arcSize, y*arcSize);

      switch (getRandomInt(0, 3)) {
        case 0:
          newArc.rotate(0);
          break;
        case 1:
          newArc.rotate(90);
          break;
        case 2:
          newArc.rotate(180);
          break;
        case 3:
          newArc.rotate(270);
      }

      opacity = getRandomInt(40, 95);
      if (opacity < 45) {
        opacity = 0;
      }
      newArc.fillColor.alpha = opacity/100;
    }
  }

  arc.remove();

  project.activeLayer.position = view.center;

  function getRandomInt(min, max) {
    return Math.floor(Math.random() * (max - min)) + min;
  }
</script>

<canvas id="canvas-0012" height="250"></canvas>