@percusse를 맞춤화하는 방법을 연구 중입니다.손으로 그린 선 시뮬레이션파라메트릭하게 만듭니다.
내 생각은 다음과 같은 것을 갖는 것입니다.
\draw[penciline={jag ratio=2},decorate,thick] (-0.4cm,-0.8cm) rectangle (1.2,-2);
또는 더 좋습니다(왜냐하면 penciline
어쨌든 장식이기 때문입니다):
\draw[penciline={jag ratio=2},thick] (-0.4cm,-0.8cm) rectangle (1.2,-2);
PGF 스타일 인수를 에 전달하려면 어떻게 해야 합니까 penciline
? jag ration
여기에서는 처리되지 않는 것 같습니다 .
내 MWE는 다음과 같습니다.
\documentclass[border=1cm]{standalone}
\RequirePackage{tikz}
\usetikzlibrary{calc,patterns,decorations,plotmarks}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\begin{document}
\pgfdeclaredecoration{penciline}{initial}{
\state{initial}[width=+\pgfdecoratedinputsegmentremainingdistance,
auto corner on length=1mm,
]{
\pgfpathcurveto%
{% 1st control point
\pgfpoint
{\pgfdecoratedinputsegmentremainingdistance*rnd*1pt}
{\pgfkeysvalueof{/tikz/penciline/jag ratio}*rand*\pgfdecorationsegmentamplitude}
}
{%% 2nd control point
\pgfpoint
%% Make sure random number is always between origin and target points
{(.5pt+0.25*rand)*\pgfdecoratedinputsegmentremainingdistance}
{\pgfkeysvalueof{/tikz/penciline/jag ratio}*rand*\pgfdecorationsegmentamplitude}
}
{% 2nd point (1st one is implicit)
\pgfpointadd
{\pgfpointdecoratedinputsegmentlast}
{\pgfpoint{rand*1pt}{rand*1pt}}
}
}
\state{final}{}
}
\tikzset{
penciline/.code={\pgfqkeys{/tikz/penciline}{#1}},
penciline={
jag ratio/.initial=5,
},
penciline/.style = {
decorate,
decoration={penciline},
},
}
\def\Grid{
\draw[penciline,decorate,style=help lines] (-2,-2) grid[step=1cm] (4,4);
}
\begin{tikzpicture}
\Grid{}
\draw[penciline,decorate,thick] (-0.4cm,-0.8cm) rectangle (1.2,-2);
\end{tikzpicture}
\end{document}
답변1
마침내 나는 이것을에게서 얻었다다른 키 목록을 인수로 가져와 설정하는 키
\tikzset{
penciline/.code={\pgfqkeys{/tikz/penciline}{#1}},
penciline={
jag ratio/.initial=5,
},
penciline/.style = {
decorate,
decoration={penciline},
penciline/.cd,
#1,
/tikz/.cd
},
decorate
}
\def\Grid{
\draw[penciline={jag ratio=1},style=help lines] (-2,-2) grid[step=1cm] (4,4);
}