TeX - LaTeX Asked by FHZ on March 9, 2021
After learning about some amazing TikZ packages such as tikzducks, tikzpeople and tikzsymbols, which I let some examples below, I harvested some inspiration to starting learning skills in order to be able to create my own set of flexible TikZ drawings.
documentclass{article}
usepackage{tikz}
usepackage{tikzducks}
usepackage{tikzpeople}
usepackage{tikzsymbols}
begin{document}
begin{tikzpicture}
duck;
duck[body=blue,scale=.3, xshift=150pt];
node[duck] at (2,0) {};
node at (3,0) {Smiley[2] dNinja[2][green!50!black][blue]};
node at (4,0) {Strichmaxerl[5]};
node[red] at (5,0) {Strichmaxerl[5][45]};
end{tikzpicture}
end{document}
When I just had an insight …
… “I could draw an Among Us Crewmate in TikZ!”.
The basic sketch came from this video: HOW TO DRAW AMONG US.
And I also checked some ideas to draw torsos.
What could be improved in order to evolve this basic sketch into something worth to become an TikZ package?
For example, tikzducks
and tikzpeople
has many optional extra features and, although tikzsymbols
has a quite different approach, tikzsymbols
still has some interesting options.
I will let an answer of my own as initial sketch.
The sketch below has a newcommand
to insert a TikZ code to draw an Among us Crewmate.
This is not a fully functional design, but there are options of colors and two emotions: angry
and very angry
.
This is just a kick start in order to (one day) become something as good as other packages.
documentclass{article}
usepackage{tikz}
usepackage{xifthen}
newcommand{FHZamongUs}[3][]{%
begin{tikzpicture}[every path/.style={very thick}]
% Backpack
draw[fill=#2, rounded corners = 3mm] (1,1) rectangle ++(0.8,3.2);
% Body
draw[fill=#2, rounded corners = 3mm] (1.5,0) -- (1.5,5)
arc (124.8074:103.8454:5) arc (80.6307:58.1808:5)-- (5,0) -- (3.7,0)
{[rounded corners = 0mm] -- (3.7,1) coordinate(A) -- (2.7,1)}
-- (2.7,0) -- cycle;
% Eyes
ifthenelse{equal{#1}{angry}}
{draw[fill=#3] plot[smooth cycle, tension=.7] coordinates
{(4.3,4.7) (5.2,4.6) (5.2,3.5) (4.2,3.2) (3.1,3.5) (3.1,4.7)};}
{ifthenelse{equal{#1}{very angry}}
{draw[fill=#3] plot[smooth cycle, tension=.7] coordinates
{(4.4,4.3) (5.2,4.6) (5.2,3.5) (4.2,3.6) (3.1,3.5) (3.1,4.7)};}
{draw[fill=#3] plot[smooth cycle, tension=.7] coordinates
{(4.3,4.9) (5.2,4.6) (5.2,3.5) (4.2,3.2) (3.1,3.5) (3.1,4.7)};}
}
% Leg detail
draw plot[smooth, tension=.7] coordinates {(A) (3.9,1) (4.2,1.1)};
end{tikzpicture}
}
begin{document}
FHZamongUs{white}{white}
FHZamongUs[angry]{yellow}{white}
FHZamongUs[very angry]{red}{cyan}
end{document}
Using the idea of a scope
inside a newcommand
from this answer and the shade style from this video, I updated the previous drawing into a style spliting each part and creating newcommand
s to combine them.
It is still not the best approach to create shades but the result and new implementation are much better than the previous attempt.
I still intend to add a hand, create the emotions in the shade-ish style and update it as a package in CTAN
.
The FHZ-amongUs.sty
file:
NeedsTeXFormat{LaTeX2e}[1994/06/01]
ProvidesPackage{FHZ-amongUs}[2020-10-18 Custom Package for my AmongUs sketch]
RequirePackage{tikz}
RequirePackage{xifthen}
usetikzlibrary{calc}
usetikzlibrary{shadings}
% ======================================= Style 0 -- Original Idea
newcommand{FHZamongUsOriginal}[3][]{%
begin{tikzpicture}[every path/.style={very thick}]
% Backpack
draw[fill=#2, rounded corners = 3mm] (1,1) rectangle ++(0.8,3.2);
% Body
draw[fill=#2, rounded corners = 3mm] (1.5,0) -- (1.5,5)
arc (124.8074:103.8454:5) arc (80.6307:58.1808:5)-- (5,0) -- (3.7,0)
{[rounded corners = 0mm] -- (3.7,1) coordinate(A) -- (2.7,1)}
-- (2.7,0) -- cycle;
% Eyes
ifthenelse{equal{#1}{angry}}
{draw[fill=#3] plot[smooth cycle, tension=.7] coordinates
{(4.3,4.7) (5.2,4.6) (5.2,3.5) (4.2,3.2) (3.1,3.5) (3.1,4.7)};}
{ifthenelse{equal{#1}{very angry}}
{draw[fill=#3] plot[smooth cycle, tension=.7] coordinates
{(4.4,4.3) (5.2,4.6) (5.2,3.5) (4.2,3.6) (3.1,3.5) (3.1,4.7)};}
{draw[fill=#3] plot[smooth cycle, tension=.7] coordinates
{(4.3,4.9) (5.2,4.6) (5.2,3.5) (4.2,3.2) (3.1,3.5) (3.1,4.7)};}
}
% Leg detail
draw plot[smooth, tension=.7] coordinates {(A) (3.9,1) (4.2,1.1)};
end{tikzpicture}
}
% =======================================
% ======================================= Style I -- Manual Shade
newcommand{FHZamongUsPackbackI}[2][]{
begin{scope}[#1]
fill[#2, rounded corners = 3mm] (1,1) coordinate(R1) rectangle ++(0.8,3.2) coordinate(R2);
fill[black!30!#2, rounded corners = 3mm] (R1) -| ($(R2)+(0,-0.2)$)
{[sharp corners]-- (1,3.5)}
-- cycle;
draw[rounded corners = 3mm] (1,1) rectangle ++(0.8,3.2);
end{scope}
}
newcommand{FHZamongUsBodyI}[2][]{
begin{scope}[#1]
fill[black!30!#2, rounded corners = 3mm] (1.5,0) -- (1.5,5)
arc (124.8074:103.8454:5) arc (80.6307:58.1808:5)-- (5,0) -- (3.7,0)
{[rounded corners = 0mm] -- (3.7,1) -- (2.7,1)}
-- (2.7,0) -- cycle;
fill[#2] plot[smooth, tension=.7]
coordinates {(1.9436,5.2721) (2.0594,2.4257) (2.9347,1.3971)
(4.4826,1.7343) (4.9666,3.0446) (4.9686,4.0294)
(4.9797,4.7974) (4.6523,5.2436) (3.4183,5.6907) (2.5265,5.5757)};
draw[rounded corners = 3mm] (1.5,0) -- (1.5,5)
arc (124.8074:103.8454:5) arc (80.6307:58.1808:5)-- (5,0) -- (3.7,0)
{[sharp corners] -- (3.7,1) coordinate(A) -- (2.7,1)}
-- (2.7,0) -- cycle;
% Leg detail
draw plot[smooth, tension=.7] coordinates {(A) (3.9,1) (4.2,1.1)};
end{scope}
}
newcommand{FHZamongUsEyesI}[2][]{
begin{scope}[#1]
fill[#2] plot[smooth cycle, tension=.7] coordinates
{(4.3,4.9) (5.2,4.6) (5.2,3.5) (4.2,3.2) (3.1,3.5) (3.1,4.7)};
fill[black!50!#2]
{plot[smooth, tension=.7] coordinates {(3.1,4.7) (3.2964,4.8157) (3.2633,4.3111) (3.4423,3.8301)
(3.794,3.6464) (4.3087,3.5904) (4.9485,3.5904) (5.2338,3.5723) (4.7492,3.2515) (3.5071,3.2661) (3.0208,3.6849) (2.9691,4.3844)}};
draw plot[smooth cycle, tension=.7] coordinates
{(4.3,4.9) (5.2,4.6) (5.2,3.5) (4.2,3.2) (3.1,3.5) (3.1,4.7)};
fill[white] plot[smooth cycle, tension=0.7]
coordinates {(4.3069,4.7316) (4.581,4.7457) (4.8219,4.7029) (4.9541,4.5887) (4.7168,4.5055) (4.3152,4.525) (4.168,4.6295)};
end{scope}
}
newcommand{FHZamongUsI}[3][]{
FHZamongUsPackbackI[#1]{#2};
FHZamongUsBodyI[#1]{#2};
FHZamongUsEyesI[#1]{#3};
}
% =======================================
% ======================================= Style II -- shade
newcommand{FHZamongUsPackbackII}[2][]{
begin{scope}[#1]
draw[shade, top color=#2, bottom color=#2!5!black, middle color=#2, rounded corners = 3mm]
(1,1) rectangle ++(0.8,3.2);
end{scope}
}
newcommand{FHZamongUsBodyII}[2][]{
begin{scope}[#1]
draw[shade, top color=#2, bottom color=#2!5!black, middle color=#2,
rounded corners = 3mm]
(1.5,0) -- (1.5,5)
arc (124.8074:103.8454:5) arc (80.6307:58.1808:5)-- (5,0) -- (3.7,0)
{[rounded corners = 0mm] -- (3.7,1) coordinate(A) -- (2.7,1)}
-- (2.7,0) -- cycle;
% Leg detail
draw plot[smooth, tension=.7] coordinates {(A) (3.9,1) (4.2,1.1)};
end{scope}
}
newcommand{FHZamongUsEyesII}[2][]{
begin{scope}[#1]
draw[shade, inner color=white!95!black, outer color=#2] plot[smooth cycle, tension=.7] coordinates
{(4.3,4.9) (5.2,4.6) (5.2,3.5) (4.2,3.2) (3.1,3.5) (3.1,4.7)};
end{scope}
}
newcommand{FHZamongUsII}[3][]{
FHZamongUsPackbackII[#1]{#2};
FHZamongUsBodyII[#1]{#2};
FHZamongUsEyesII[#1]{#3};
}
% =======================================
endinput
The main.tex
file:
documentclass{article}
usepackage[margin=2cm,landscape]{geometry}
usepackage{FHZ-amongUs}
begin{document}
begin{tikzpicture}
FHZamongUsPackbackI[shift={(0,0)}]{yellow};
FHZamongUsBodyI[shift={(0,0)}]{yellow};
FHZamongUsEyesI[shift={(0,0)}]{cyan};
% ===========
FHZamongUsI[shift={(5,0)}]{red}{blue};
FHZamongUsI[shift={(10,0)}]{green}{gray};
FHZamongUsI[shift={(15,0)}]{blue}{orange};
% ===========
FHZamongUsPackbackII[shift={(0,7)}]{yellow};
FHZamongUsBodyII[shift={(0,7)}]{yellow};
FHZamongUsEyesII[shift={(0,7)}]{cyan};
% ===========
FHZamongUsII[shift={(5,7)}]{red}{blue};
FHZamongUsII[shift={(10,7)}]{green}{gray};
FHZamongUsII[shift={(15,7)}]{blue}{orange};
end{tikzpicture}
FHZamongUsOriginal{yellow}{cyan}
FHZamongUsOriginal[angry]{yellow}{cyan}
FHZamongUsOriginal{black}{white}
FHZamongUsOriginal[angry]{gray}{white}
FHZamongUsOriginal[very angry]{white}{black}
end{document}
and the results are:
I updated drawings, syntax and names creating a package that is now avaliable at https://www.ctan.org/pkg/tikz-among-us.
The documentation also presents some interesting applications such as animation and page numbering.
Answered by FHZ on March 9, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP