RedeyeVentures\GeoPattern\GeoPattern::geoMosaicSquares PHP Method

geoMosaicSquares() protected method

protected geoMosaicSquares ( )
    protected function geoMosaicSquares()
    {
        $triangleSize = $this->map($this->hexVal(0, 1), 0, 15, 15, 50);
        $this->svg->setWidth($triangleSize * 8)->setHeight($triangleSize * 8);
        $i = 0;
        for ($y = 0; $y <= 3; $y++) {
            for ($x = 0; $x <= 3; $x++) {
                if ($x % 2 == 0) {
                    if ($y % 2 == 0) {
                        $this->drawOuterMosaicTile($x * $triangleSize * 2, $y * $triangleSize * 2, $triangleSize, $this->hexVal($i, 1));
                    } else {
                        $this->drawInnerMosaicTile($x * $triangleSize * 2, $y * $triangleSize * 2, $triangleSize, [$this->hexVal($i, 1), $this->hexVal($i + 1, 1)]);
                    }
                } else {
                    if ($y % 2 == 0) {
                        $this->drawInnerMosaicTile($x * $triangleSize * 2, $y * $triangleSize * 2, $triangleSize, [$this->hexVal($i, 1), $this->hexVal($i + 1, 1)]);
                    } else {
                        $this->drawOuterMosaicTile($x * $triangleSize * 2, $y * $triangleSize * 2, $triangleSize, $this->hexVal($i, 1));
                    }
                }
                $i++;
            }
        }
    }