7

Consider the following MWE:

\documentclass[export,border=5pt,tikz]{standalone}
\usetikzlibrary{decorations.text,calc}
\begin{document}
\foreach \n in {0,1,...,10}
{
    \begin{tikzpicture}
    \useasboundingbox (-7,-10) rectangle (8,8);
%       \pgfmathsetmacro{\w}{(-1)^\n * (\q/20)}
        \pgfmathsetmacro{\w}{4*cos(\n r)*\n}
        \begin{scope}[xshift=-.5cm,yshift=-\n cm,rotate=\w]
            \draw (0,0) circle(.5);
            \draw (0,-.5) --+ (0,-1.5) --+ (.5,-2);
            \draw (0,-2) --+ (-.5,-.5);
                \draw (-1,0) -- (0,-1) --+ (1,1);
            \fill[black,radius=.05] (-1,0) circle;
            \fill[black,radius=.05] (1,0) circle;
                \draw (-1,0) --+ (.5,2);
                \draw (1,0) --+ (-.5,2);
            \draw[yshift=1.3cm,fill=red] (.8,0) arc(0:180:.8) arc(0:-180:.1) arc(-180:-360:1) arc(0:-180:.1);
    %           \node
            \path[thick,postaction={decorate,decoration={text along path,text align=center,text={|\tiny\color{white}\bf|TeX.SX}}}] (1,1.13) arc(0:-540:1);
        \end{scope}

    \begin{scope}[xshift=-.5*\n cm]
        \fill[yshift=6cm,rotate around={(45:(1,0))},rounded corners=.5cm] (0,0) rectangle (2,-4);

        \fill[xshift=-5cm,yshift=5cm,rounded corners=.5cm,black] (0,0) rectangle (10,2);
        \foreach \x in {0,1,...,8}
        {
            \fill[xshift=\x cm,white,xshift=-4.4cm,yshift=6.3cm,rounded corners=.1cm] (0,0) rectangle (.7,.5);
        }
        \draw[xshift=-3.5cm,yshift=5.05cm,line width=3pt] (0,0) --+ ([yshift=.1*\n cm]2,-.5);
        \draw[xshift=2.5cm,yshift=5.05cm,line width=3pt] (0,0) --+ ([yshift=.1*\n cm]-2,-.5);

        \node at (7.3,6) (a) {\large \TeX.SX rocks!!!};
            \draw[thick] ([xshift=-.1cm]a.north west) -- ($(a.north west)!.2!(a.south west)$) -- ($(a.south west)!.2!(a.north west)$) -- ([xshift=-.1cm]a.south west) -- ([xshift=.1cm]a.south east) -- ($(a.south east)!.2!(a.north east)$) -- (a.north east) -- ([xshift=.1cm]a.north east) -- cycle;
                \draw ([yshift=-.2cm]a.north west) --+ (-2,0);
                \draw ([yshift=.2cm]a.south west) --+ (-2,0);
    \end{scope}
    \end{tikzpicture}
}
\end{document}

Screenshot

My questions are:

  • How can the "node-drawing" move sinus-like in the wind?
  • How can the stick figure move down in a "zig-zag-rounded way" (imagine the stick man moves in a zigzag like way down, but the edges between two consecutive points of the zigzag-line is rounded)?

EDIT: For J Leon V.:

\documentclass[border=5pt,tikz]{standalone}
\begin{document}
    \begin{tikzpicture}
        \begin{scope}
            \clip[draw] [xshift=-2cm,yshift=-3.5cm] (1,-.3) .. controls (-3,1) and (-2,-2) .. (-.5,-3) --+ (-.7,0) arc(90:180:.9) to[bend right=5] (.35,-3.9);
                    \draw[xshift=-1.5cm,yshift=-4.5cm] (-.4,0) to[bend right=10] (-1.5,.2);
                \draw[xshift=-3.7cm,yshift=-7.5cm] (0,0) to[bend left=10] (0,.5);
                \draw[xshift=-3.4cm,yshift=-7.5cm] (0,0) to[bend left=10] (0,.5);
        \end{scope}
            \draw[xshift=2cm,yshift=-6cm,double distance=1mm] (-.25,-.25) .. controls (1.5,-.25) and (1,1) .. (0,1.5);
        \begin{scope}[xscale=-1,xshift=1cm]
        \draw[xshift=-2.5cm,yshift=-5.5cm,double distance=1mm,rotate=140] (0,0) .. controls (1,1) and (2,-1) .. (4,0);
        \fill[xshift=-2cm,yshift=-3.5cm,white] (1,-.3) .. controls (-3,1) and (-2,-2) .. (-.5,-3) --+ (-.7,0) arc(90:180:.9) to[bend right=5] (.35,-3.9);
            \clip[draw] [xshift=-2cm,yshift=-3.5cm] (1,-.3) .. controls (-3,1) and (-2,-2) .. (-.5,-3) --+ (-.7,0) arc(90:180:.9) to[bend right=5] (.35,-3.9);
                    \draw[xshift=-1.3cm,yshift=-4.5cm] (-.4,0) to[bend right=10] (-1.5,.2);
                \draw[xshift=-3.7cm,yshift=-7.5cm] (0,0) to[bend left=10] (0,.5);
                \draw[xshift=-3.4cm,yshift=-7.5cm] (0,0) to[bend left=10] (0,.5);
        \end{scope}
        \begin{scope}
            \clip[draw] [xshift=-1cm,yshift=.6cm] (0,0) to[bend left=10] (-1,.5) arc(90:270:.4);
                \draw[scale=.9,xshift=-1.2cm,yshift=.5cm] (0,0) to[bend left=10] (-1,.5) arc(90:270:.4);
        \end{scope}
        \begin{scope}[xshift=-1.1cm]
            \clip[draw] [xscale=-1,xshift=-1cm,yshift=.6cm] (0,0) to[bend left=10] (-1,.5) arc(90:270:.4);
                \draw[xscale=-1,scale=.9,xshift=-1.2cm,yshift=.5cm] (0,0) to[bend left=10] (-1,.5) arc(90:270:.4);
        \end{scope}
            \draw[xshift=-1.8cm,yshift=-3.6cm] (0,0) --+ (-.4,-3.5);
            \draw[xshift=.6cm,yshift=-3.6cm] (0,0) --+ (.4,-3.5);
        \draw[fill=white,xscale=1.2,xshift=-.53cm,yshift=-1.2cm] (.05,2) to[bend right=5] (-.4,1.95) to[bend left=10] (-.1,1.93) to[bend right=10] (-1,1.65) --+ (.2,0) to[bend right=10] (-1.4,1.4) to[bend left=10] (-1.1,1.4) to[bend right=10] (-1.6,.8) to[bend left=10] (-1.4,.8) to[bend right=10] (-1.7,0) to[bend left=10] (-1.4,.1) to[bend right=10] (-1.6,-.7) to[bend left=10] (-1.4,-.5) to[bend right=10] (-1.4,-1.2) to[bend left=5] (-1.2,-1) to[bend right=10] (-1.3,-1.8) to[bend left=5] (-1.2,-1.7) to[bend right=10] (-1.2,-2.3) to[bend left=5] (-1,-2) to[bend right=10] (-1,-2.7) to[bend left=10] (-.8,-2.4) to[bend right=10] (-.7,-3.2) to[bend left=5] (-.5,-2.7) to[bend right=10] (.07,-3.4);
            \draw[fill=white,xscale=-1.2,xshift=.48cm,yshift=-1.2cm] (.05,2) to[bend right=5] (-.4,1.95) to[bend left=10] (-.1,1.93) to[bend right=10] (-1,1.65) --+ (.2,0) to[bend right=10] (-1.4,1.4) to[bend left=10] (-1.1,1.4) to[bend right=10] (-1.6,.8) to[bend left=10] (-1.4,.8) to[bend right=10] (-1.7,0) to[bend left=10] (-1.4,.1) to[bend right=10] (-1.6,-.7) to[bend left=10] (-1.4,-.5) to[bend right=10] (-1.4,-1.2) to[bend left=5] (-1.2,-1) to[bend right=10] (-1.3,-1.8) to[bend left=5] (-1.2,-1.7) to[bend right=10] (-1.2,-2.3) to[bend left=5] (-1,-2) to[bend right=10] (-1,-2.7) to[bend left=10] (-.8,-2.4) to[bend right=10] (-.7,-3.2) to[bend left=5] (-.5,-2.7) to[bend right=10] (-.015,-3.4);
                \draw[rounded corners=1pt] (-.55,-.13) .. controls (-.7,-.12) and (-1,-.2) .. (-1.5,0) .. controls (-1.9,-1) and (-1.9,-1) .. (-1.9,-2) to[bend right=5] (-1.5,-2.1) to[bend right=5] (-1.4,-2.8) to[bend right=5] (-.55,-3);
                \draw (-1.4,-2.78) --+ (.06,-.5) to[bend right=5] (-.55,-3.4);
                    \draw[xshift=-1.2cm,yshift=-2.96cm] (0,.1) to[bend left=5] (.1,.5) to[bend right=5] (.2,.04);
                \draw (-1.1,-.8) circle(.4);
                \draw (-1,-.8) circle(.1);
                    \draw[xshift=-.7cm,yshift=-2cm] (.15,0) to[bend left=5] (-.5,.2) to[bend right=5] (.15,-.15);
                \begin{scope}[xscale=-1,xshift=1.1cm]
                    \draw[rounded corners=1pt] (-.55,-.13) .. controls (-.7,-.12) and (-1,-.2) .. (-1.5,0) .. controls (-1.9,-1) and (-1.9,-1) .. (-1.9,-2) to[bend right=5] (-1.5,-2.1) to[bend right=5] (-1.4,-2.8) to[bend right=5] (-.55,-3);
                    \draw (-1.4,-2.78) --+ (.06,-.5) to[bend right=5] (-.55,-3.4);
                        \draw[xshift=-1.2cm,yshift=-2.96cm] (0,.1) to[bend left=5] (.1,.5) to[bend right=5] (.2,.04);
                    \draw (-1.1,-.8) circle(.4);
                    \draw (-1,-.8) circle(.1);
                        \draw[xshift=-.7cm,yshift=-2cm] (.15,0) to[bend left=5] (-.5,.2) to[bend right=5] (.15,-.15);
                \end{scope}
        \fill[fill=white,scale=1.2,yshift=-6.3cm,xshift=-2cm,rounded corners] (0,0) -- (1.5,0) to[bend right=10] (1.4,.6) to[bend right=10] (0,.4) -- cycle;
        \begin{scope}
            \clip[draw] [scale=1.2,yshift=-6.3cm,xshift=-2cm,rounded corners] (0,0) -- (1.5,0) to[bend right=10] (1.4,.6) to[bend right=10] (0,.4) -- cycle;
                \draw[scale=1.2,yshift=-6.3cm,xshift=-2.1cm,rounded corners] (.4,0) to[bend left=10] (.4,.3);
                \draw[scale=1.2,yshift=-6.3cm,xshift=-1.9cm,rounded corners] (.4,0) to[bend left=10] (.4,.3);
        \end{scope}
        \begin{scope}
            \draw[xscale=-1,fill=white,scale=1.2,yshift=-6.3cm,xshift=-1cm,rounded corners] (0,0) -- (1.5,0) to[bend right=10] (1.4,.6) to[bend right=10] (0,.4) -- cycle;
                \draw[xscale=-1,scale=1.2,yshift=-6.3cm,xshift=-1.1cm,rounded corners] (.4,0) to[bend left=10] (.4,.3);
                \draw[xscale=-1,scale=1.2,yshift=-6.3cm,xshift=-.9cm,rounded corners] (.4,0) to[bend left=10] (.4,.3);
        \end{scope}
        \begin{scope}[xshift=4.52cm,yshift=-2.77cm,scale=.3,rotate=15]
            \draw (0,0) .. controls (1,.5) and (1.5,-.5) .. (2,-.5);
                \draw[yscale=-1,yshift=1cm] (0,0) .. controls (1,.5) and (1.5,-.5) .. (2,-.5);
                \draw (0,.02) -- (0,-.4);
                \draw (0,-.7) -- (0,-1);
        \end{scope}
    \end{tikzpicture}
\end{document}

Here is the output:

Screenshot

  • 2
    +1 Consider converting your pdf to an animated gif using the convert chain from here and posting it. (Maybe you need a little bit larger bounding box.) And you can use decorations.markings to move any object along any path, just like in the police car chasing example. (A zig zag with rounded corners may well be approximated by some sine function.) – user121799 Aug 30 '18 at 22:13
  • 2
    @current_user For a more realistic airplane, see this answer: tex.stackexchange.com/a/114847/36296 :) – samcarter is at topanswers.xyz Aug 31 '18 at 16:07
  • @samcarter: Thank you, I already know, but I wanted to keep things simple. But anyways, thank you again! – current_user Aug 31 '18 at 16:08
10

Just for fun. tikzkoalas.sty can be found here. Maybe it will become part of an official package in some future.

\documentclass[export,border=5pt,tikz]{standalone}
\usepackage{tikzkoalas}
\usetikzlibrary{decorations.text,calc,decorations.markings}
\newsavebox\Koala
\sbox\Koala{\tikz{
\begin{scope}[local bounding box=koala]
\koala
\end{scope}
\foreach \X in {135,120,...,45}
{\draw (koala.\X) -- ++ (\X:1);}
\shade[ball color=blue] ($(koala.45)+(45:1)$) to[bend right=35] ($(koala.135)+(135:1)$)
to[out=90,in=90,looseness=2] cycle;}}
\begin{document}
\foreach \n in {0,1,...,20}
{
    \begin{tikzpicture}
    \useasboundingbox (-7,-10) rectangle (8,8);
        \pgfmathsetmacro{\w}{4*cos(\n r)*\n}
        \path[postaction=decorate,decoration={markings,mark=at position
        \n/20 with {\node[rotate={30*sin(\n*36)}]{\usebox\Koala};}}] plot[variable=\x,domain=0:720,samples=72] ({-1+1.5*sin(\x)},{4-\x/90});
    \begin{scope}[xshift=-.5*\n cm]
        \draw
        [line width=8mm,red,postaction={decorate,decoration={text along path,text
        align=center,text={|\large\color{white}\bfseries|TeX.SX rocks!!}}}] 
        plot[variable=\x,domain=0:360,samples=72] 
        ({4.8+\x/90},{6+0.2*cos(\x+\n*54)});
        \fill[yshift=6cm,rotate around={(45:(1,0))},rounded corners=.5cm] (0,0) rectangle (2,-4);

        \fill[xshift=-5cm,yshift=5cm,rounded corners=.5cm,black] (0,0) rectangle (10,2);
        \foreach \x in {0,1,...,8}
        {
            \fill[xshift=\x cm,white,xshift=-4.4cm,yshift=6.3cm,rounded corners=.1cm] (0,0) rectangle (.7,.5);
        }
        \draw[xshift=-3.5cm,yshift=5.05cm,line width=3pt] (0,0) --+ ([yshift=.1*\n cm]2,-.5);
        \draw[xshift=2.5cm,yshift=5.05cm,line width=3pt] (0,0) --+ ([yshift=.1*\n cm]-2,-.5);

    \end{scope}
    \end{tikzpicture}
}
\end{document}

enter image description here

  • 1
    +1 nice animation, I would like there to be a lion that can jump like that coala... T_T – J Leon V. Aug 31 '18 at 4:30
  • 1
    In my opinion, the orig. movement of the match stick man looks more realistic. – AlexG Aug 31 '18 at 5:15
  • 2
    @AlexG You're right. Better now? – user121799 Aug 31 '18 at 10:40
  • 1
    @marmot Indeed, much better now! – AlexG Aug 31 '18 at 10:47
  • 2
    @current_user, thank you for your time for that drawing, mmm will make me try hard to leave something colorful here but have patience, the lions are very lazy when they have a full belly. – J Leon V. Aug 31 '18 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.