[Latex]利用animate和tikz宏包很容易绘制流程图的动画,如下:
%\input{tikz_file/图4-1.tex} %传热学 {\centering \small %----------------------------------------------------------------- \begin{animateinline}[autoplay,poster=last, begin={% \begin{tikzpicture}[node distance=4mm and 4mm , >=stealth,scale=1,line width=0.2pt, place/.style={rounded corners=1mm,rectangle,draw=blue!75,fill=yellow!75,thick, inner sep=1pt,minimum width=45mm}, placeG/.style={rounded corners=1mm,rectangle,draw=blue!75,fill=yellow!75,thick, inner sep=1pt,minimum width=25mm}, post/.style={->,shorten >=1pt,very thick,black} ] \useasboundingbox(0,0)rectangle(10,7); }, end={ \end{tikzpicture} }, timeline=图4-1.timeline ]{2} %节点 \coordinate (T) at(4,6.5); %0定义坐标 \newframe \node[place] (A) at(T) {建立控制方程和定解条件}; %1 \newframe \node[place] (B) [below=of A ] {确定节点(区域离散化)}; %2 \newframe \node[place] (C) [below=of B ] {建立节点物理量的代数方程}; %3 \newframe \node[place] (D) [below=of C ] {设立温度场的迭代初值}; %4 \newframe \node[place] (E) [below=of D ] {求解代数方程组}; %5 \newframe \node(F) [below=of E,shape aspect=2.5,rounded corners=1mm,diamond,draw=blue!75,fill=yellow!75,thick, inner sep=1pt,minimum width=30mm] {是否收敛?}; %6 \newframe \node[placeG] (G) [right=of E] {改进初场}; %7 \newframe \node[place] (H) [below=of F] {解的分析}; %8 %绘制箭头 \newframe \draw (A) edge[post](B); %9 \newframe \draw (B) edge[post](C); %10 \newframe \draw (C) edge[post](D); %11 \newframe \draw (D) edge[post](E); %12 \newframe \draw (E) edge[post](F); %13 \newframe \node (J0) [above,black] at ($(F.east)+(1,0)$){否}; %14 \draw[->,very thick,black] (F.east) -|(G.south); % \draw[->,very thick,black] (G.north) |-($(D)!0.5!(E)$); % \newframe \node (J) [above,red] at ($(F.east)+(1,0)$){否}; %15 \draw[->,very thick,red] (F.east) -|(G.south); \draw[->,very thick,red] (G.north) |-($(D)!0.5!(E)$); \newframe \node (I) [right,black] at ($(F.south)!0.5!(H.north)$){是}; %16 \draw (F) edge[->,shorten >=1pt,line width =2pt,black](H);% \newframe \draw (F) edge[->,shorten >=1pt,line width =2pt,green](H);%17 \node (I0) [right,green] at ($(F.south)!0.5!(H.north)$){是}; \end{animateinline} } %----------------------------------------------------------------- \endinput
其中timeline文件如下:
:3:0x0 :3:1x0 :3:2x0 :3:3x0 :3:4x0 :3:5x0 :3:6x0 :3:7x0 :3:8x0 :3:9x0 :3:10x0 :3:11x0 :3:12x0 :3:13x0 :2:14x1 :2:15x1 :2:14x1 :2:15x1 :2:14x1 :2:15x0 :2:16x1 :2:17x1 :2:16x1 :2:17x1 :2:16x1 :2:17x0 :2:18x0最后一 帧动画的显示界面如下: