# [Tex/LaTex] TikZ and FIFA WorldCup 2018: Flags of Nations

funtikz-pgf

I am a kind of TikZ addict, and also be a fan of football. This time – WorldCup 2018 – is nice change of relaxing by drawing flags of 32 football teams by pure TikZ or TikZ-based codes. Some are easy (like the Japan flag ^^), some are somehow difficult! Please join and/or suggest me!

Let me start with the South-Korean flag. In its code, I like the way of (i) drawing the Yin Yang symbols and the 4 black trigrams via only one parameter \YYrotation; (ii) using scope, foreach, and (iii) using a trick of coloring black/white trigrams with a little bit bigger line width. I first draw trigrams at (0,0), then use rotation and shift to move to the corners. Description of the South-Korean flag can be found here https://en.wikipedia.org/wiki/Flag_of_South_Korea

The followings are the TikZ codes for the South-Korean flag.

% Description of The SOUTH-KOREAN FLAG
% https://en.wikipedia.org/wiki/Flag_of_South_Korea
% A rectangle: width = 2/3 length,
% the Yin Yang symbol (red above, blue below) at center,
% the 4 black trigrams at 4 corners.

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}

\begin{tikzpicture}
\def\a{7.5}  % a half of the length
\def\b{5}    % a half of the width
\def\r{1.25} % radius of the Yin/Yang symbol

% radius of the big circle
\pgfmathsetmacro{\R}{2*\r}
% the rotation angle of Yin/Yang/trigrams
\pgfmathsetmacro{\YYrotation}{atan(3/2)}

% the whole rectangle of the flag
\path (-\a,-\b) rectangle (\a,\b);

% the Yin Yang symbol: draw, then rotate
\begin{scope}[rotate=\YYrotation]
\fill[red] (0,\R) arc (90:-90:\R) arc(-90:90:\r) arc(270:90:\r);
\fill[blue] (0,-\R) arc (270:90:\R) arc(90:270:\r) arc(90:-90:\r);
\end{scope}

% the spring trigram (the above-left corner)
\begin{scope}[rotate=\YYrotation,shift={(0,4.6)},line width=.42 cm]
\foreach \j in {0,5/8,-5/8} \draw (-5/4,\j)--(5/4,\j);
\end{scope}

% the autumn trigram (the below-left corner)
\begin{scope}[rotate=-\YYrotation,shift={(0,-4.6)},line width=.42 cm]
\foreach \j in {0,5/8,-5/8} \draw (-5/4,\j)--(5/4,\j);
\draw[white,line width=.44 cm] (-5/48,0)--(5/48,0);
\end{scope}

% the winter trigram (the above-right corner)
\begin{scope}[rotate=-\YYrotation,shift={(0,4.6)},line width=.42 cm]
\foreach \j in {0,5/8,-5/8} \draw (-5/4,\j)--(5/4,\j);
\foreach \j in {5/8,-5/8} \draw[white,line width=.44 cm] (-5/48,\j)--(5/48,\j);
\end{scope}

% the summer trigram (the below-right corner)
\begin{scope}[rotate=\YYrotation,shift={(0,-4.6)},line width=.42 cm]
\foreach \j in {0,5/8,-5/8} \draw (-5/4,\j)--(5/4,\j);
\foreach \j in {0,5/8,-5/8} \draw[white,line width=.44 cm] (-5/48,\j)--(5/48,\j);
\end{scope}
\end{tikzpicture}
\end{document}


Here one for Peru, The normal flag of my country is simple, what happens is that for this 2018 tournament, they have used the flag with a shield, so in this post I will try to complete it even with the shield and the frame style that they have given it, on the official page of FIFA.

Although my country has already been eliminated but hopefully at least winning its last game.

UPDATE: Finishig the tikz drawing using decorations markings library.

MWE:

% arara: pdflatex: {synctex: yes, action: nonstopmode}
% By J. Leon V. Share as Beerware philosophy
\documentclass[border=20pt]{standalone}
\usepackage{xcolor}
\definecolor{gold}{HTML}{D1BA87}
\definecolor{Redper}{HTML}{C60C30}
\definecolor{sky}{HTML}{0083C4}
\definecolor{vicug}{HTML}{A84A0E}
\usepackage{tikz}
\usepackage{pgfmath}
\usepackage{xifthen}
\usepackage[keli]{malayalam}

\begin{document}
\begin{tikzpicture}[
%Environment Styles
Laurel/.style={
draw,
double=green!50!black,
postaction={
decorate,
decoration={
markings,
mark=between positions 0.4 and 0.8 step 0.2
with {
\draw[double=green!50!black,line width=0.5pt](0,0) [out=0,in=135]
to ++(0.25,-.1)
(0,0) [out=0,in=-90]
to ++(0.25,.15);
\draw[fill=Redper](0.25,-.1) circle (1.2pt);
\draw[fill=Redper](0.25,.15) circle (1.2pt);
}
}
},
postaction={
decorate,
decoration={
markings,
mark=between positions 0.3 and 1 step 0.2
with {
\draw[fill=green!50!black](0,0) [out=-45,in=180]
to ++(0.5,-.1)[out=105,in=0]
to cycle;
\draw[fill=green!50!black](0,0) [out=-45,in=180]
to ++(0.5,-.2)[out=105,in=0]
to cycle;
\draw[fill=green!50!black](0,0) [out=45,in=180]
to ++(0.5,.1)[out=-105,in=0]
to cycle;
\draw[fill=green!50!black](0,0) [out=45,in=180]
to ++(0.5,.2)[out=-105,in=0]
to cycle;
}
}
}
},
Palma/.style={
draw,
double=green!50!black,
postaction={
decorate,
decoration={
markings,
mark=between positions 0.3 and 1 step 0.08
with {
\draw[fill=green!50!black](0,0) [out=-30,in=160]
to ++(0.5,-.2)[out=150,in=0]
to cycle;
\draw[fill=green!50!black](0,0) [out=-30,in=160]
to ++(0.5,-.3)[out=150,in=0]
to cycle;
\draw[fill=green!50!black](0,0) [out=30,in=-160]
to ++(0.6,.0)[out=-150,in=0]
to cycle;
\draw[fill=green!50!black](0,0) [out=30,in=-160]
to ++(0.6,.1)[out=-150,in=0]
to cycle;
\draw[fill=green!50!black](0,0) [out=15,in=180]
to ++(0.65,-0.1)[out=-180,in=-15]
to cycle;
}
}
}
},
Corona/.style={
draw,
double=green!50!black,
postaction={
decorate,
decoration={
markings,
mark=between positions 0 and 0.95 step 0.1
with {
\draw[fill=green!50!black](0,0) [out=-45,in=-135]
to ++(0.15,0)[out=135,in=45]
to cycle;
\draw[fill=green!50!black](0,0) [out=-90,in=180]
to ++(0.1,-.1)[out=90,in=0]
to cycle;
\draw[fill=green!50!black](0,0) [out=90,in=-180]
to ++(0.1,.1)[out=-90,in=0]
to cycle;
}
}
}
},
Quina/.style={
draw,
double=green!50!black,
postaction={
decorate,
decoration={
markings,
mark=between positions 0 and 1 step 0.5
with {
\fill[fill=green!50!black](0,0) [out=-45,in=-135]
to ++(0.08,0)[out=135,in=45]
to cycle;
\fill[fill=green!50!black](0,0) [out=-90,in=180]
to ++(0.05,-.05)[out=90,in=0]
to cycle;
\fill[fill=green!50!black](0,0) [out=90,in=-180]
to ++(0.05,.05)[out=-90,in=0]
to cycle;
}
}
}
}
]
% Image to used to get coordinates. obtained from my country in fifa web page.
%\node[inner sep=0pt] (FIG1) at (0,8) {\includegraphics[scale=2]{Peru-flag-russia-2018.pdf}};

\fill[fill=Redper,out=48,in=180] (-6.2,0)
to ++(2.5,3.1)
-- ++(7.45,0)[out=0,in=138]
to ++(2.5,-3.1)[out=-138,in=0]
to ++(-2.5,-3.1)
-- ++(-7.45,0)[out=180,in=-48]
to cycle;
\fill[fill=white,even odd rule]
(0,0)++(-2.05,-3.1) rectangle ++(4.1,6.2);
\fill[fill=gold,even odd rule]
[out=48,in=180] (-6.2,0)
to ++(2.5,3.1)
-- ++(7.45,0)[out=0,in=138]
to ++(2.5,-3.1)[out=-138,in=0]
to ++(-2.5,-3.1)
-- ++(-7.45,0)[out=180,in=-48]
to cycle
[out=48,in=180] (-6.6,0)
to ++(2.6,3.25)
-- ++(8,0)[out=0,in=138]
to ++(2.6,-3.25)[out=-138,in=0]
to ++(-2.6,-3.25)
-- ++(-8,0)[out=180,in=-48]
to cycle;

%Shield W.I.P.

\draw[color=gold!80!black,line width=2pt,fill=Redper](0,0)++(-0.66,0)[out=-90,in=90]
to ++(-0.17,-0.46)[out=-90,in=180]
to ++(0.33,-0.33)[out=0,in=105]
to ++(.5,-0.2)[out=75,in=180]
to ++(.5,0.2)[out=0,in=-90]
to ++(0.33,0.33)[out=90,in=-90]
to ++(-0.17,0.46);

\draw[color=gold!80!black,line width=2pt,fill=sky](0,0) --++(-0.66,0)[out=90,in=-30]
to ++(-0.25,0.4)[out=30,in=-105]
to ++(0.25,0.35)[out=-20,in=-135]
to ++(0.66,0.15) -- cycle;

\draw[color=gold!80!black,line width=2pt,fill=white](0,0)--++(0.66,0)[out=90,in=-150]
to ++(0.25,0.4)[out=150,in=-75]
to ++(-0.25,0.35)[out=-160,in=-45]
to ++(-0.66,0.15) -- cycle;

\draw[Laurel](0,0)++(-0.7,-1.5)[out=35,in=180]
to ++(0.7,0.3)[out=0,in=-95]
to ++(1.3,0.8)[out=85,in=-50]
to ++(-.3,1.2);%1

\draw[Palma](0,0)++(0.7,-1.5)[out=145,in=0]
to ++(-0.7,0.3)[out=180,in=-65]
to ++(-1.15,0.5)[out=115,in=-120]
to ++(0,1.5);%1

\draw[Corona](0,0)++(0,0.9)[out=0,in=-90]
to ++(0.4,0.25)[out=90,in=0]
to ++(-0.4,0.25);

\draw[Corona](0,0)++(0,0.9)[out=180,in=-90]
to ++(-0.4,0.25)[out=90,in=180]
to ++(0.4,0.25);

\draw[double=gold!60!black,line width=0.5pt](0,0)++(0.37,0.04)
-- ++(0,0.4);

\draw[Quina](0,0)++(0.37,0.35) coordinate (A)
-- ++(0,0.2);
\draw[Quina](A) -- ++(0.12,0.12);
\draw[Quina](A) -- ++(-0.12,0.12);
\draw[Quina](A)++(0,-0.15) -- ++(0.12,0.12);
\draw[Quina](A)++(0,-0.15) -- ++(-0.12,0.12);

% Draw Vicugna
\draw[fill=vicug](0,0)++(-0.25,0.1)
-- ++(0.02,0) -- ++(0.03,0.2)[out=0,in=-90] to ++(0.02,0.2) -- ++(0.06,0) --  ++ (-0.01,0.03)
-- ++(-0.04,0.02)--  ++ (-0.02,0.02)--  ++ (0,0.05)--  ++ (-0.04,-0.05)--  ++ (-0.01,-0.02)[out=-135,in=0]
to ++(-0.05,-0.16)[out=165,in=15] to ++(-0.25,0.04)[out=180,in=90] to ++(-0.05,-0.04)[out=180,in=90]
to ++(-0.02,-0.04)[out=45,in=90] to ++(0.03,-0.03)[out=-90,in=90] to ++(0.04,-0.08)[out=-90,in=90]
to ++(0.03,-0.06)[out=-90,in=90]to ++(0.02,-0.08) -- ++(0.02,0 )-- ++(0.03,0.15)[out=-90,in=135] to ++(0.15,-0.03)
-- cycle;

% Draw Rich Cornus
\draw[fill=gold](0,0)++(0.5,-0.45)[out=180,in=-90] to ++ (-0.05,0.05)[out=90,in=180] to ++ (0.05,0.05)
[out=0,in=90] to ++ (0.15,-0.15)[out=-90,in=0] to ++ (-0.18,-0.15) -- ++ (0,0.1)[out=0,in=-90] to ++ (0.1,0.1)
[out=90,in=0] to ++ (-0.05,0.05)[out=180,in=135] to cycle;
\foreach \distance in {0,0.4,0.45,...,1}{
\draw[
draw=none,
decoration={
markings,
mark=at position \distance with {
\draw[fill=gold] (0,0) circle (5*\distance pt);
}
},
postaction={decorate}
](0,0)++(0.5,-0.45) arc (270:90:0.05)
arc (90:-90:0.12)[out=180,in=0] to ++(-0.6,0.38)[out=180,in=60] to ++(-0.2,-0.17);
}

\foreach \distance in {0,1,...,40}{
\draw[fill=gold!] (0,0)++(-0.3+rand*0.15,-0.4-rand*0.15) circle (1pt and 0.5pt);
}

\end{tikzpicture}
\end{document}