我从这里有这个活塞动画:
\documentclass[tikz]{standalone}
\usetikzlibrary{shapes}
\tikzset{
relative to node/.style={
shift={(#1.center)},
x={(#1.east)},
y={(#1.north)},
},
kolben/.pic={
\node[fill=white,draw,minimum width=1.5cm,minimum height=1.3cm] (-a) at (0,0.2) {};
\begin{scope}[relative to node=-a]
\draw (-1,0.2) -- ++(2,0);
\draw (-1,0.3) -- ++(2,0);
\draw (-1,0.4) -- ++(2,0);
\end{scope}
\draw (0,0) circle(0.07);
},
valve/.pic={
\draw[fill=white] (-0.175,0) -- (-0.125,0.05) -- (-0.05,0.05) -- (-0.05,0.15) -- (-0.075,0.15) -- (-0.075,0.2) -- (0.075,0.2) -- (0.075,0.15) -- (0.05,0.15) -- (0.05,0.05) -- (0.125,0.05) -- (0.175,0) -- cycle;
},
cylinder/.pic={
\draw (-0.75,1.55) -- (-0.8,1.55) -- (-0.8,5.05) -- (-0.5,5.05) -- (-0.55,5) -- (-0.75,5) -- cycle;
\draw (-0.25,5.05) -- (-0.2,5) -- (0.2,5) -- (0.25,5.05) -- cycle;
\draw[xscale=-1] (-0.75,1.55) -- (-0.8,1.55) -- (-0.8,5.05) -- (-0.5,5.05) -- (-0.55,5) -- (-0.75,5) -- cycle;
},
crank/.pic={
\draw[fill=white,rounded corners=1mm] (90:0.75) arc (90:270:0.75) -- (0,-0.1) [rounded corners=0mm] -- (1,-0.1) arc (-90:90:0.1) [rounded corners=1mm] -- (0,0.1) -- cycle (1,0) circle (0.05);
}
}
\begin{document}
\foreach \phase [
evaluate=\phase as \x using {int(mod(\phase + 90,360))},
evaluate=\phase as \case using {int(mod(\phase/180,4))},
evaluate=\x as \d using {40*sin(\x)+50},
] in {0,5,...,719}{
\begin{tikzpicture}
\useasboundingbox (-2,-2) rectangle (2,6);
\coordinate (pivot) at (0,{3+sin(\x)});
\coordinate (piston-top) at (0,{3+sin(\x)+1.3/2+0.2});
\ifcase\case
\colorlet{gascolor}{blue!10}
\pgfmathsetmacro\valveone{1}
\pgfmathsetmacro\valvetwo{0}
\or
\colorlet{gascolor}{blue!\d}
\pgfmathsetmacro\valveone{0}
\pgfmathsetmacro\valvetwo{0}
\or
\colorlet{gascolor}{red!\d}
\pgfmathsetmacro\valveone{0}
\pgfmathsetmacro\valvetwo{0}
\or
\colorlet{gascolor}{gray!10}
\pgfmathsetmacro\valveone{0}
\pgfmathsetmacro\valvetwo{1}
\fi
\draw[line width=14.9mm,gascolor] (piston-top) -- (0,5);
\pic (cylinder) at (0,0) {cylinder};
\pic (valve1) at (-0.375,{5-0.1*\valveone}) {valve};
\pic (valve2) at (0.375,{5-0.1*\valvetwo}) {valve};
\draw[double distance=2mm-\pgflinewidth,line cap=round] (\x:1) -- (pivot);
\pic[rotate=\x] (crank) at (0,0) {crank};
\pic (kolben) at (pivot) {kolben};
\node[anchor=base] at (1.25,3) {$ x $};
\ifnum\x=0
\fill[red] (1,3) circle (1.5pt);
\else
\ifnum\x=180
\fill[red] (1,3) circle (1.5pt);
\else
\draw[->,red,ultra thick] (1,3) -- +(0,{sin(\x)});
\fi
\fi
\node[anchor=base] at (1.75,3) {$ \dot{x} $};
\ifnum\x=90
\fill[blue] (1.5,3) circle (1.5pt);
\else
\ifnum\x=270
\fill[blue] (1.5,3) circle (1.5pt);
\else
\draw[->,blue,ultra thick] (1.5,3) -- +(0,{cos(\x)});
\fi
\fi
\ifnum\phase=360
\begin{scope}
\clip (-7.5mm,5cm-0.5\pgflinewidth) rectangle (7.5mm,3cm);
\node[starburst,starburst point height=3mm,inner color=yellow,outer color=red,draw=orange] at (0,5) {};
\end{scope}
\fi
\end{tikzpicture}
}
\end{document}
另一个是水箱
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shadings}
\begin{document}
\begin{tabular}{cc}
\begin{tikzpicture}[>=latex]
\def\r{3}
\def\H{1.5}
\begin{scope}
\draw[clip,-] ({\r*cos(-95)},{\r*sin(-95)})
--++ (0,{-0.1*\r}) --++ ({2*\r *sin(5)},0) -- ({\r*cos(-85)},{\r*sin(-85)}) arc [start angle=-85,end
angle=265,radius=\r];
\shade[ball color=gray!15,opacity=0.5] (0,0) circle (\r);
\shade[top color=blue!50!gray,bottom color=blue!20!white,opacity=0.6]
({-\r},{-1.1*\r}) rectangle ++({2*\r},{0.1*\r+\H});
\fill[blue!50] (0,{-\r+\H}) circle [x radius={sqrt(\r^2-(\r-\H)^2)},
y radius={0.2*sqrt(\r^2-(\r-\H)^2)}];
\end{scope}
\draw[thick,->] (0,{-1.05*\r}) -- ++(0,{-0.3*\r}) node[right]{$v_e$};
\fill[fill=black] (0,0) circle (1pt);
\draw[dashed,|<->|] (0,0 ) -- node[above]{$R$} (210:\r);
\draw[|<->|] (4,{-\r}) --
node[fill=white,font=\footnotesize,inner ysep=2pt,inner xsep=0]{$h$}
(4,{-\r+\H});
\end{tikzpicture}
\end{tabular}
\end{document}
如何组合它们左边是活塞,右边是水箱,所以当活塞完成 10 个循环时,水箱中的水将是空的。
您可以对水箱使用另一个代码,这只是我的一个例子。