Police chasing with TikZ
Here is a first version. I was not aware that the rounded corners had such an impact on the tangent slope. My bad, fixed it
\documentclass[border=5pt,tikz]{standalone}
\usetikzlibrary{intersections,snakes,decorations.markings,calc,shapes.geometric}
\tikzset{water/.style={decorate,decoration={zigzag,segment
length=3mm,amplitude=.5mm}}}
\definecolor{police}{RGB}{27,128,196}
\definecolor{sirene}{RGB}{240,79,35}
\definecolor{windows}{RGB}{189,230,250}
\definecolor{tire}{RGB}{121,131,140}
\definecolor{mark}{RGB}{246,235,21}
\definecolor{star}{RGB}{242,103,34}
\definecolor{street}{RGB}{46,46,46}
\definecolor{forest}{RGB}{34,139,34}
\definecolor{deep}{RGB}{31,61,12}
\definecolor{aqua}{RGB}{107,202,226}
\tikzset{
pentagon/.style={
shape=star, star points=5, star point ratio=1.9, draw,minimum
width=3mm,fill=#1}}
\newsavebox\PoliceCar
\sbox\PoliceCar{\tikz{
\node[minimum width=1cm,minimum height=.5cm] (a) at (0,0) {};
\fill[windows] ([xshift=.2cm,yshift=.25cm]a.south west) -- ([yshift=-.01cm,xshift=.4cm]a.north west) -- ([yshift=-.01cm,xshift=-.24cm]a.north east) -- ([xshift=-.1cm,yshift=.25cm]a.south east);
\path[fill=police] (a.south west) -- ([yshift=.25cm]a.south west) -- ([yshift=.25cm,xshift=.1cm]a.south east) -- ([xshift=.1cm]a.south east);
\path[fill=white] ([xshift=.2cm]a.south west) -- ([xshift=.2cm,yshift=.25cm]a.south west) -- ([xshift=.9cm,yshift=.25cm]a.south west) -- ([xshift=.9cm]a.south west);
\draw (a.south west) -- ([yshift=.25cm]a.south west) --+ (.2,0) -- ([yshift=-.01cm,xshift=.4cm]a.north west) -- ([yshift=-.01cm,xshift=-.24cm]a.north east) -- ([yshift=.25cm,xshift=.9cm]a.south west) -- ([yshift=.25cm,xshift=.1cm]a.south east) -- ([xshift=.1cm]a.south east) -- cycle;
\draw ([xshift=.2cm]a.south west) -- ([xshift=.2cm,yshift=.25cm]a.south west) -- ([xshift=.9cm,yshift=.25cm]a.south west) -- ([xshift=.9cm]a.south west);
\fill[black,radius=.1] ([xshift=.2cm]a.south west) circle;
\fill[black,radius=.1] ([xshift=-.1cm]a.south east) circle;
\fill[sirene] ([xshift=0cm]a.north) -- ([xshift=.15cm]a.north) arc(0:180:.075);
\node[xshift=.05cm,yshift=-.13cm,pentagon=yellow,scale=0.3] at (a.center) {};
}
}
\newsavebox\Racer
\sbox\Racer{\tikz{\node[minimum width=1cm,minimum height=.5cm] (a) at
(0,0) {};
\fill[windows] ([xshift=.2cm,yshift=.25cm]a.south west) -- ([yshift=-.01cm,xshift=.4cm]a.north west) -- ([yshift=-.01cm,xshift=-.24cm]a.north east) -- ([xshift=-.1cm,yshift=.25cm]a.south east);
\path[fill=black] (a.south west) -- ([yshift=.25cm]a.south west) -- ([yshift=.25cm,xshift=.1cm]a.south east) -- ([xshift=.1cm]a.south east);
\path[fill=black] ([xshift=.2cm]a.south west) -- ([xshift=.2cm,yshift=.25cm]a.south west) -- ([xshift=.9cm,yshift=.25cm]a.south west) -- ([xshift=.9cm]a.south west);
\draw (a.south west) -- ([yshift=.25cm]a.south west) --+ (.2,0) -- ([yshift=-.01cm,xshift=.4cm]a.north west) -- ([yshift=-.01cm,xshift=-.24cm]a.north east) -- ([yshift=.25cm,xshift=.9cm]a.south west) -- ([yshift=.25cm,xshift=.1cm]a.south east) -- ([xshift=.1cm]a.south east) -- cycle;
\draw ([xshift=.2cm]a.south west) -- ([xshift=.2cm,yshift=.25cm]a.south west) -- ([xshift=.9cm,yshift=.25cm]a.south west) -- ([xshift=.9cm]a.south west);
\draw (a.south west) -- (a.south east);
\fill[tire,radius=.1] ([xshift=.2cm]a.south west) circle;
\fill[tire,radius=.1] ([xshift=-.1cm]a.south east) circle;
}
}
\begin{document}
\foreach \X in {0,0.03,...,0.9}
{\begin{tikzpicture}
\draw[scale=1.1,xshift=-.5cm,yshift=.5cm,fill=street,yshift=-2cm,rounded corners] (0,0) rectangle (10,-8);
\draw[xshift=.25cm,yshift=.25cm,fill=aqua,rounded corners,yshift=-3.5cm,xshift=1.5cm] (0,0) rectangle (2,-2);
\draw[xshift=0cm,yshift=.25cm,fill=forest,rounded corners,yshift=-3.5cm,xshift=6.5cm] (0,0) rectangle (2,-2);
\begin{scope}[yshift=-.5cm]
\draw[fill=forest,rounded corners,yshift=-6.5cm,xshift=1.5cm] (0,0) rectangle (7,-2);
\foreach \x in {1,2,...,5}
{
\fill[xshift=9.3cm,yshift=-7.7cm,deep,rotate=180] (1.3*\x,0) arc(180:360:.5) -- (1.3*\x+1,0) parabola[parabola height=1mm] (1.3*\x,0);
}
\end{scope}
\draw[ultra thick,yellow!90!black,xshift=.55cm,yshift=-2.5cm,rounded corners,dashed,scale=.9] (0,0) rectangle (10,-8);
\draw[ultra thick,yellow!90!black,yshift=-2cm,rounded corners,dashed] (5,-.5) --+ (0,-3.5) --+ (-4.5,-3.5) --+ (4.55,-3.5);
\draw[xshift=.25cm,yshift=.25cm,yshift=-4cm,xshift=1.5cm,water,blue] (.3,0) -- (1.7,0);
\draw[xshift=.25cm,yshift=.25cm,yshift=-4.3cm,xshift=1.5cm,water,blue] (.3,0) -- (1,0);
\draw[xshift=.25cm,yshift=.25cm,yshift=-4.6cm,xshift=1.5cm,water,blue] (1,0) -- (1.7,0);
\draw[xshift=.25cm,yshift=.25cm,yshift=-4cm,yshift=-.9cm,xshift=1.5cm,water,blue] (.3,0) -- (1.7,0);
\path[use as bounding box] (current bounding box.south west) rectangle
(current bounding box.north east);
\draw[xshift=.7cm,ultra thick,blue,opacity=.7,->,rounded corners=5mm,
postaction={decorate,decoration={markings,mark=at position 1.1*\X
with {\path (-10pt,0) coordinate(tmp1) (10pt,0) coordinate(tmp2);
\pgftransformreset
\draw let
\p1=($(tmp2)-(tmp1)$),\n1={atan2(\y1,\x1)} in
(tmp1) node[rotate=\n1] {\usebox\PoliceCar};}}}]
(5,-2) -| (9,-6);
\draw[xshift=.7cm,ultra thick,red,opacity=.7,->,rounded corners=5mm,
postaction={decorate,decoration={markings,mark=at position \X
with {\path (-1pt,0) coordinate(tmp1) (1pt,0) coordinate(tmp2);
\pgftransformreset
\path let \p1=($(tmp2)-(tmp1)$),\n1={atan2(\y1,\x1)} in
(tmp1) node[rotate=\n1] {\usebox\Racer};}}}]
(-.5,-5.2) |- (9,-6.1);
\end{tikzpicture}}
\end{document}
just for fun and to expose my point, I use the recycled code to draw the road from Drawing street curve, then doing the positioning node in a path including an image, in this case images transformed to svg edited in inkscape and exported to pdf format, you can access these files on my drive, available until the big G disappears, consists of 4 sprites 2 for each car, which I alternate in a certain frame.
RESULT:
MWE: To run you need to download the pdf files Sprite-police-side.pdf
,Sprite-police-front.pdf
,Sprite-car-front.pdf
,Sprite-car-side.pdf
, or any tikz pdf output, inkscape pdf output,etc., to the forder where the main .tex file is saved.
% arara: pdflatex: {synctex: yes, action: nonstopmode}
% arara: animate: {density: 100, delay: 13, other: -background white -alpha remove}
% arara: showanimate
\documentclass[tikz,border=20pt]{standalone}
\usetikzlibrary{arrows,positioning,backgrounds,patterns}
\definecolor{grass}{HTML}{296402}
\definecolor{way}{HTML}{373737}
\tikzset{
%STYLES
runway node/.style={% Runway
rounded corners,
way,
line width=54pt,
preaction={
draw,
way,
line width=60pt,
},
preaction={
draw,
yellow,
line width=55pt, % Yellow border lines.
},
postaction={
draw,
white,
line width=19pt,
dash pattern=on 35pt off 15pt, % Here control the road division lines
},
postaction={
draw,
way,
line width=18pt,
}
}
}
\begin{document}
\foreach \x in {1,...,30}{
\pagecolor{grass}
\begin{tikzpicture}
%Runways
\draw[runway node]
(0,0) rectangle ++(12,-12)
(0,-6) -- ++(12,0)
(6,-6) -- ++(0,6);
\draw[pattern=horizontal lines light blue,rounded corners=10pt] (1.5,-4.5) rectangle (4.5,-1.5) ;
\draw[ultra thick,->,blue,rounded corners=1cm]
(6,0)
\ifnum\x<14
-| ++(6,-6)node[pos=\x/30]{\includegraphics[scale=0.12]{Sprite-police-side}};
\else
-| ++(6,-6)node[pos=\x/30]{\includegraphics[scale=0.15]{Sprite-police-front}};
\fi
\draw[ultra thick,->,red,rounded corners=1cm]
(0,-3)
\ifnum\x<16
|- ++(12,-3)node[pos=\x/30]{\includegraphics[scale=0.15]{Sprite-car-front}};
\else
|- ++(12,-3)node[pos=\x/30]{\includegraphics[scale=0.12]{Sprite-car-side}};
\fi
\end{tikzpicture}
}
\end{document}
PSD: animation done with imagemagick converter.