Skip to content

Commit

Permalink
Merge pull request #1050 from 3geek14/rounding-error-pics
Browse files Browse the repository at this point in the history
Tweaked `foreach` loops in example diagrams to avoid a floating-point rounding error.
  • Loading branch information
muzimuzhi authored Sep 25, 2021
2 parents a497067 + 6c74102 commit a18a8d6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions doc/generic/pgf/text-en/pgfmanual-en-base-animations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ \subsubsection{Specifying the Timeline}
animation list={0.333/\frac{1}{3},0.666/\frac{2}{3},1,1.333/1\frac{1}{3},1.666/1\frac{2}{3}},
]
\tikz {
\foreach \i in {0,0.1,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\foreach \i in {0,0.125,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\pgfanimateattribute{translate}{
whom = node, begin on = {click},
exit control={1}{0},
Expand Down Expand Up @@ -370,7 +370,7 @@ \subsubsection{Specifying the Timeline}
animation list={0.5,1,1.5,2,2.5},
]
\tikz {
\foreach \i in {0,0.1,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\foreach \i in {0,0.125,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\pgfanimateattribute{translate}{
whom = node, begin on = {click},
entry = {0s}{\pgfpointorigin},
Expand All @@ -392,7 +392,7 @@ \subsubsection{Specifying the Timeline}
animation list={0.5,1,1.5,2},
]
\tikz {
\foreach \i in {0,0.1,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\foreach \i in {0,0.125,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\pgfanimateattribute{translate}{
whom = node, begin on = {click},
entry = {0s}{\pgfpointorigin},
Expand Down
12 changes: 6 additions & 6 deletions doc/generic/pgf/text-en/pgfmanual-en-tikz-animations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2544,7 +2544,7 @@ \subsubsection{Smoothing and Jumping Timelines}
animation list={0.333/\frac{1}{3},0.666/\frac{2}{3},1,1.333/1\frac{1}{3},1.666/1\frac{2}{3}},
]
\tikz {
\foreach \i in {0,0.1,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\foreach \i in {0,0.125,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\node :yshift = { begin on = click,
0s = { exit control = {1}{0}, "0cm" },
1s = "-5mm",
Expand All @@ -2558,7 +2558,7 @@ \subsubsection{Smoothing and Jumping Timelines}
animation list={0.333/\frac{1}{3},0.666/\frac{2}{3},1,1.333/1\frac{1}{3},1.666/1\frac{2}{3}},
]
\tikz {
\foreach \i in {0,0.1,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\foreach \i in {0,0.125,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\node :yshift = { begin on = click,
0s = "0cm",
1s = "-5mm",
Expand All @@ -2572,7 +2572,7 @@ \subsubsection{Smoothing and Jumping Timelines}
animation list={0.333/\frac{1}{3},0.666/\frac{2}{3},1,1.333/1\frac{1}{3},1.666/1\frac{2}{3}},
]
\tikz {
\foreach \i in {0,0.1,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\foreach \i in {0,0.125,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\node :yshift = { begin on = click,
0s = { exit control = {1}{0}, "0cm" },
1s = "-5mm",
Expand Down Expand Up @@ -2608,7 +2608,7 @@ \subsubsection{Smoothing and Jumping Timelines}
animation list={0.333/\frac{1}{3},0.666/\frac{2}{3},1,1.333/1\frac{1}{3},1.666/1\frac{2}{3}},
]
\tikz {
\foreach \i in {0,0.1,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\foreach \i in {0,0.125,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\node :yshift = { begin on = click, ease, 0s = "0cm", 2s = "-10mm" }
[fill = blue!20, draw = blue, very thick, circle] {Click me!};
}
Expand All @@ -2630,7 +2630,7 @@ \subsubsection{Smoothing and Jumping Timelines}
animation list={0.5,1,1.5,2,2.5},
]
\tikz {
\foreach \i in {0,0.1,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\foreach \i in {0,0.125,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\node :yshift = { begin on = click,
0s = "0cm",
1s = {stay, "-5mm"},
Expand All @@ -2651,7 +2651,7 @@ \subsubsection{Smoothing and Jumping Timelines}
animation list={0.5,1,1.5,2,2.5},
]
\tikz {
\foreach \i in {0,0.1,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\foreach \i in {0,0.125,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\node :yshift = { begin on = click,
0s = "0cm",
1s = {jump, "-5mm"},
Expand Down
2 changes: 1 addition & 1 deletion doc/generic/pgf/text-en/pgfmanual-en-tikz-coordinates.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ \subsubsection{The Syntax of Partway Modifiers}
\begin{tikzpicture}
\draw [help lines] (0,0) grid (4,4);
\foreach \i in {0,0.1,...,2}
\foreach \i in {0,0.125,...,2}
\fill ($(2,2) !\i! \i*180:(3,2)$) circle (2pt);
\end{tikzpicture}
\end{codeexample}
Expand Down
2 changes: 1 addition & 1 deletion doc/generic/pgf/text-en/pgfmanual-en-tikz-pics.tex
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ \subsection{The Pic Syntax}
%
\begin{codeexample}[]
\tikz \draw (0,0) .. controls(1,0) and (2,1) .. (3,1)
foreach \t in {0, 0.1, ..., 1} {
foreach \t in {0, 0.125, ..., 1} {
pic [pos=\t] {code={\draw circle [radius=2pt];}}
};
\end{codeexample}
Expand Down

0 comments on commit a18a8d6

Please sign in to comment.