RedeyeVentures\GeoPattern\GeoPattern::geoOverlappingRings PHP Method

geoOverlappingRings() protected method

protected geoOverlappingRings ( )
    protected function geoOverlappingRings()
    {
        $scale = $this->hexVal(0, 1);
        $ringSize = $this->map($scale, 0, 15, 10, 60);
        $strokeWidth = $ringSize / 4;
        $this->svg->setWidth($ringSize * 6)->setHeight($ringSize * 6);
        $i = 0;
        for ($y = 0; $y <= 5; $y++) {
            for ($x = 0; $x <= 5; $x++) {
                $val = $this->hexVal($i, 1);
                $opacity = $this->opacity($val);
                $fill = $this->fillColor($val);
                $styles = ['fill' => 'none', 'stroke' => $fill, 'style' => ['opacity' => $opacity, 'stroke-width' => "{$strokeWidth}px"]];
                $ringSizeMinusHalfStrokeWidth = $ringSize - $strokeWidth / 2;
                $this->svg->addCircle($x * $ringSize, $y * $ringSize, $ringSizeMinusHalfStrokeWidth, $styles);
                // Add an extra one at top-right, for tiling.
                if ($x == 0) {
                    $this->svg->addCircle(6 * $ringSize, $y * $ringSize, $ringSizeMinusHalfStrokeWidth, $styles);
                }
                // Add an extra row at the end that matches the first row, for tiling.
                if ($y == 0) {
                    $this->svg->addCircle($x * $ringSize, 6 * $ringSize, $ringSizeMinusHalfStrokeWidth, $styles);
                }
                // Add an extra one at bottom-right, for tiling.
                if ($x == 0 && $y == 0) {
                    $this->svg->addCircle(6 * $ringSize, 6 * $ringSize, $ringSizeMinusHalfStrokeWidth, $styles);
                }
                $i++;
            }
        }
    }