TikZ provides fill patterns (section 15.5.1 in the docs).
Instead of filling a path with a single solid color, it is also possible to fill it with a tiling pattern. Imagine a small tile that contains a simple picture like a star. Then these tiles are (conceptually) repeated infinitely in all directions, but clipped against the path.
Is there an option to offset the pattern? So that the tiles at the edge of the pattern are (conceptually) cut off at a specific place?
I tried combining pattern
with clip
, but it didn't change anything.
\clip (0, 0) rectangle (1, 1);
\fill [pattern color=black, pattern=fivepointed stars] (-0.8, -0.7) rectangle (1, 1);
Both
\documentclass[]{standalone}
\usepackage{tikz}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
\fill[pattern color=black, pattern=fivepointed stars] (0, 0) rectangle (1, 1);
\end{tikzpicture}
\end{document}
and
\documentclass[]{standalone}
\usepackage{tikz}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
\clip (0, 0) rectangle (1, 1);
\fill[pattern color=black, pattern=fivepointed stars] (-0.2, -0.3) rectangle (1, 1);
\end{tikzpicture}
\end{document}
produce
I am looking for a way to get something like this
where the pattern is just offset compared to the first drawing.
tikzpicture
in it to illustrate the situation, in two versions side by side, one without clip and one with clip, and add a screenshot to the question?