tikz 画一个视力表

2019-09-15 01:20发布


登录 后发表评论
1条评论
咸菜的味道
1楼 · 2019-09-17 14:01

\documentclass[tikz]{standalone} \usepackage{ctex} \usepackage{tikz} \usetikzlibrary{backgrounds} \setmainfont{Arial} \begin{document} \begin{tikzpicture} \draw[line width=2.5pt] (0,-3)--(0,3); \draw[line width=2.5pt] (3,0)--(-3,0); \pgfmathsetseed{666} \def\circlerd{100}%用于计算圆的半径,单位将是 pt \foreach \y[count=\yj from 0] / \s in {1/5.4,2/5.3,3/5.2,4/5.1,5/5.0,6/4.9,7/4.8,8/4.7,9/4.6,10/4.5} { \pgfmathparse{\circlerd +0.5*\y*10+0.5*\yj*10+60+ln(\y)*60} \xdef\circlerd{\pgfmathresult}%第 \y 个圆的半径,单位将是 pt \pgfmathparse{\y*10} \edef\textboxdm{\pgfmathresult pt}% 文字盒子的尺寸 \foreach \x in {0,7.5,...,352.5} { \pgfmathsetmacro{\thisrand}{random(1,4)*90} \pgfmathsetmacro{\isnumposition}{equal(mod(\x,90),0) ? 1 : 0} \ifnum\isnumposition=0% \node at (\x:\circlerd pt) {{\resizebox{\textboxdm}{!}{{\rotatebox{\thisrand}{E}}}}}; \else \node at (\x:\circlerd pt) {{\resizebox{\textboxdm}{!}{\s}}}; \fi } } \begin{scope}[on background layer] \fill[fill=gray!40](0,0)circle(\circlerd pt + 120pt); \fill[fill=white](0,0)circle(\circlerd pt + 100pt); \end{scope} \end{tikzpicture} \end{document} 就想到这么多了