summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikzpingus/tikzpingus-technology.lib.tex
blob: fbb2f484198be21c1a405f3748a2ea29a38f1173 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
% Florian Sihler, 2022
% Licensed under GNU General Public License version 3
% https://opensource.org/licenses/gpl-3.0.html
\pingu@create@extra{vrheadset}{%
    vr-headset/.code             = \pingu@set@extra{vrheadset}{true}\pingu@color{vrheadset}{#1},
    vr-headset/.default          = pingu@black!92!gray,
    vr-headset band/.code        = \pingu@color{vrheadset@band}{#1},
    vr-headset band top/.code    = \pingu@color{vrheadset@band@top}{#1},
    vr-headset text/.code        = \def\pingu@x@vrheadset@text{#1},
    vr-headset text color/.code  = \pingu@color{vrheadset@text@color}{#1},
    vr-headset hair/.style       = {/pingu/hair 2=!hide,/pingu/hair 3=!hide,/pingu/hair 4=!hide}
}{vr-headset band=\pingu@color@vrheadset!92!gray,vr-headset text={\textit{\textsf{VR\thinspace\texttrademark}}},vr-headset text color=pingu@white,vr-headset band top=\pingu@color@vrheadset!96!gray}

\def\pingu@draw@ea@vrheadset{%
\pingu@layer{middle}[]
    \pingu@block{\pingu@color@vrheadset} [rounded corners=1.25mm]([yshift=3.45mm]\pingu@name-waist-right|-\pingu@name-eye-right) to[bend left=2] coordinate[pos=.5] (@) ([yshift=3.45mm]\pingu@name-waist-left|-\pingu@name-eye-left) to[bend left=3] coordinate (\pingu@name-vrh-ol) ++(0,-6.25mm) to[bend left=13] ([yshift=-1mm]\pingu@name-head-center) to[bend left=13] ([yshift=3.45mm-6.25mm]\pingu@name-waist-right|-\pingu@name-eye-right) -- cycle;
    \path (\pingu@name-vrh-ol)++(-2.25mm,2mm) node[text=\pingu@color@vrheadset@text@color,scale=.25] {\pingu@x@vrheadset@text};
\endpingu@layer
\if@pingu@do@back@\else
    % top band
    \pingu@block[rounded corners=1pt]{\pingu@color@vrheadset@band@top} (@)++(-1.05mm+.15mm,0) to[bend right=2] ([xshift=-.85mm+.3mm,yshift=.3mm]\pingu@name-head-top) to[bend left=2] ++(1.6mm,0) to[bend left=2] ([xshift=1.25mm+.15mm]@);
\fi
    % we draw a band for the background
\pingu@layer{background}[]
\pingu@block[line cap=round]{\pingu@color@vrheadset@band} ([yshift=1mm]\pingu@name-waist-right|-\pingu@name-eye-right) to[bend left=3] coordinate[pos=.5] (@b) ([yshift=1mm]\pingu@name-waist-left|-\pingu@name-eye-left) arc(90:-90:.25mm and 1mm) to[bend right=3] ([yshift=-1mm]\pingu@name-waist-right|-\pingu@name-eye-right) arc (270:90:.25mm and 1mm);
\pingu@block[rounded corners=1pt]{\pingu@color@vrheadset@band@top} (@b)++(-1.25mm+.2mm,-1.25mm) to[bend right=2] ([xshift=-.85mm+.3mm,yshift=.3mm]\pingu@name-head-top) to[bend right=2] ++(1.6mm,0) to[bend right=2] ([xshift=1.15mm+.2mm,yshift=-1.25mm]@b) -- cycle;
\endpingu@layer
}
\pingu@create@extra{headphone}{%
    headphones/.forward to      = /pingu/headphone,
    headphone/.code             = \pingu@set@extra{headphone}{true}\pingu@color{headphone}{#1},
    headphone/.default          = pingu@blue!80!pingu@black,
    headphone left/.code        = \pingu@color{headphone@left}{#1},
    headphone right/.code       = \pingu@color{headphone@right}{#1},
    headphones outer/.forward to  = /pingu/headphone outer,
    headphone outer/.style        = {/pingu/headphone left outer=#1,/pingu/headphone right outer=#1}, headphone outer/.default      = pingu@black,
    headphone left outer/.code    = \pingu@color{headphone@left@p}{#1}, headphone left outer/.default  =pingu@black,
    headphone right outer/.code   = \pingu@color{headphone@right@p}{#1}, headphone right outer/.default=pingu@black,
    headphones inner/.forward to  = /pingu/headphone inner,
    headphone inner/.style        = {/pingu/headphone left inner=#1,/pingu/headphone right inner=#1}, headphone inner/.default      = pingu@black,
    headphone left inner/.code    = \pingu@color{headphone@left@i}{#1}, headphone left inner/.default = pingu@black,
    headphone right inner/.code   = \pingu@color{headphone@right@i}{#1}, headphone right inner/.default=pingu@black,
}{headphone left=\pingu@color@headphone!65!pingu@black,headphone right=\pingu@color@headphone@left,headphone left outer=\@pingu@none,
,headphone right outer=\@pingu@none,,headphone left inner=\@pingu@none,
,headphone right inner=\@pingu@none}

\def\pingu@draw@ea@headphone{%
\if@pingu@do@back@ \pingu@layer{background}[] \fi
    \pingu@block[rounded corners=.1mm]{\pingu@color@headphone@right@p} ([xshift=-\pingu@one,yshift=3.22mm]\pingu@name-wings-side-right|-\pingu@name-eye-right) arc (93:273:.565mm and 2.11mm) -- ++(.8mm,.075mm) -- ++(0,4.075mm);
    \pingu@block[rounded corners=.1mm]{\pingu@color@headphone@right@i} ([xshift=\pingu@one-.366mm,yshift=3.22mm]\pingu@name-wings-side-right|-\pingu@name-eye-right) arc (87:-93:.565mm and 2.14mm) -- ++(-.8mm,.075mm) -- ++(0,4.075mm) -- cycle;
    \pingu@block[rounded corners=.1mm]{\pingu@color@headphone@right} ([xshift=-\pingu@one+.2mm,yshift=3.22mm]\pingu@name-wings-side-right|-\pingu@name-eye-right) arc (92:272:.565mm and 2.1mm) -- ++(.8mm,-.05mm) arc (270:450:.425mm and 2.1mm) -- cycle;
    \pingu@block[rounded corners=.1mm]{\pingu@color@headphone@left@p} ([xshift=\pingu@one,yshift=3.22mm]\pingu@name-wings-side-left|-\pingu@name-eye-left) arc (87:-93:.565mm and 2.11mm) -- ++(-.8mm,.075mm) -- ++(0,4.075mm) -- cycle;
    \pingu@block[rounded corners=.1mm]{\pingu@color@headphone@left@i} ([xshift=-\pingu@one+.366mm,yshift=3.22mm]\pingu@name-wings-side-left|-\pingu@name-eye-left) arc (93:273:.565mm and 2.14mm) -- ++(.8mm,.075mm) -- ++(0,4.075mm);
    \pingu@block[rounded corners=.1mm]{\pingu@color@headphone@left} ([xshift=\pingu@one-.2mm,yshift=3.22mm]\pingu@name-wings-side-left|-\pingu@name-eye-left) arc (88:-92:.565mm and 2.1mm) -- ++(-.8mm,-.05mm) arc (270:90:.425mm and 2.1mm) -- cycle;
    \pingu@block{\pingu@color@headphone} ([xshift=-\pingu@one,yshift=\pingu@one]\pingu@name-wings-side-right|-\pingu@name-eye-right)
    arc(180:0:{\pingu@one+\pingu@w@half} and {\pingu@head@h@half-.5\pingu@one}) arc(0:-180:.65mm and .33mm)
    arc(0:180:{\pingu@one+\pingu@w@half-2*.65mm} and {\pingu@head@h@half+.33\pingu@one-2*.6mm-1.1\pingu@one})
    arc(0:-180:.65mm and .33mm) -- cycle;
\if@pingu@do@back@ \endpingu@layer \fi
}

\pingu@create@wing@extra{vrcontroller}{%
vr-controller \@lr/.code         = {\pingu@set@extra{vrcontroller\@lr}{true}\pingu@color{vrcontroller\@lr}{##1}},
vr-controller \@lr/.default      = pingu@green,
vr-controller \@lr\space handle/.code = \pingu@color{vrcontroller\@lr @handle}{##1},%
vr-controller \@lr\space second/.code = \pingu@color{vrcontroller\@lr @second}{##1},%
vr-controller \@lr\space second shade/.code = \pingu@color{vrcontroller\@lr @second@shade}{##1}%
}{vr-controller \@lr\space handle={\csname pingu@color@vrcontroller\@lr\endcsname!76!pingu@black},vr-controller \@lr\space second={\csname pingu@color@vrcontroller\@lr\endcsname!56!pingu@black},vr-controller \@lr\space second shade={\csname pingu@color@vrcontroller\@lr\endcsname!96!pingu@black}}

% #1 wing
\def\pingu@draw@wi@vrcontroller#1{%
    \pingu@setup@wing{vrcontroller}{#1}%
    \pingu@block[rotate around={\@angle:(\pingu@name-wing-#1)}]{\csname pingu@color@vrcontroller#1@handle\endcsname}(\pingu@name-wing-#1)++(.5mm,5mm) to[bend right=1] ++(-.25mm,-5.5mm) arc (0:-180:.325mm and .1mm) to[bend right=1] ++(-.7mm,5.5mm) -- cycle coordinate[pos=.5] (@);
    \def\@y{2.06mm} \def\@@y{.78mm}
    \pingu@block[rotate around={\@angle:(\pingu@name-wing-#1)},even odd rule]{\csname pingu@color@vrcontroller#1@second\endcsname}([yshift=.1mm]@) arc (90:450:{\@y} and 1mm) coordinate[pos=.25] (@r) coordinate[pos=.75] (@l) ([yshift=-.6mm]@) arc (90:0:{\@@y} and .25mm) arc (0:-180:{\@@y} and .35mm) arc (180:90:{\@@y} and .25mm);
    % \pingu@draw[rotate around={\@angle:(\pingu@name-wing-#1)}]{\csname pingu@color@vrcontroller#1@second@shade\endcsname} ([yshift=-.9mm]@)++(180:{\@@y} and .3mm) arc (180:0:{\@@y} and .3mm);
    \def\@toruslow{(@l) to[bend left=7] ++(-.2mm,-.875mm) to[bend left=15] coordinate[pos=.95] (@c) ++(-2*\@y+.4mm,0) [sharp corners] to[bend left=7] ++(-.2mm,.875mm) to[bend right=30] cycle}
    \pingu@block[rounded corners=.1mm,rotate around={\@angle:(\pingu@name-wing-#1)}]{\csname pingu@color@vrcontroller#1@second\endcsname} \@toruslow;
    \scope[rounded corners=.1mm,rotate around={\@angle:(\pingu@name-wing-#1)}]
    \clip \@toruslow;
    \pingu@block[opacity=.1]{black} (@l) to[bend left=14] (@c) -- ++(0,-2mm) -| cycle;
    \endscope
}


\pingu@create@wing@extra{laptop}{%
  laptop \@lr/.code                  = {\pingu@set@extra{laptop\@lr}{true}\pingu@color{laptop\@lr}{##1}},
  laptop \@lr/.default               = gray!80!pingu@white,
  laptop \@lr\space bracket/.code    = \pingu@color{laptop\@lr @bracket}{##1},
  laptop \@lr\space lower/.code      = \pingu@color{laptop\@lr @lower}{##1},
  laptop \@lr\space key/.code        = \pingu@color{laptop\@lr @key}{##1},
  laptop \@lr\space display/.code    = \pingu@color{laptop\@lr @display}{##1},
  laptop \@lr\space content/.code    = \@namedef{pingu@x@laptop\@lr @content}{##1}, % tikz content
  laptop \@lr\space mid/.code        = \@namedef{pingu@x@laptop\@lr @mid}{##1}, % tikz content
}{laptop \@lr\space bracket=pingu@black!80!\csname pingu@color@laptop\@lr\endcsname,laptop \@lr\space lower=\csname pingu@color@laptop\@lr\endcsname!95!pingu@black,laptop \@lr\space key=\csname pingu@color@laptop\@lr\endcsname!92!pingu@white,laptop \@lr\space display=\csname pingu@color@laptop\@lr\endcsname!32!pingu@white,laptop \@lr\space content={},laptop \@lr\space mid={}}

% #1 wing
\def\pingu@draw@wi@laptop#1{%
    \pingu@setup@wing{laptop}{#1}%
    \scope[rotate around={\@angle+5:(\pingu@name-wing-#1)},shift={(\pingu@name-wing-#1)}]
        \pingu@block[rounded corners=1pt]{\csname pingu@color@laptop#1@lower\endcsname}(-6.9mm,0) -- ++(-.1mm,-4.75mm) -- ++(14mm,0) -- ++(-.1mm,4.75mm) -- cycle;
        \pingu@block[rounded corners=1pt]{\@col}(-6.9mm,0) -- ++(0,7mm) -- ++(13.8mm,0) -- ++(0,-7mm) -- cycle;
        \pingu@block[rounded corners=.125mm]{\csname pingu@color@laptop#1@bracket\endcsname}(-6.4mm,.125mm) -- ++(0,-.25mm) -- ++(12.8mm,0) -- ++(0,.25mm) -- cycle;
        % keys
        \foreach[count=\y from 0,evaluate=\y as \extpadding using 0.005*\y,evaluate=\y as \rextpadding using 0.05*\y] \row in {
            % manually account for padding
                {0,1,1,1,1,1,1,1,1,1,1,1,1,1},
                {.63,1.5,1,1,1,1,1,1,1,1,1,1,1},
                {0,1,1,1,1,1,1,1,1,1,1,1,1,1},
                {0,1,1,1,1,1,4.62,1,1,1,1},
            } {
            \def\lengthincr{-\rextpadding mm}
            \foreach[count=\i from 0,evaluate=\len as \l using 0.85*\len] \len in \row {
                \ifnum\i=0 \else % first one is silent:
                \pingu@block[rounded corners=.125mm]{\csname pingu@color@laptop#1@key\endcsname}(\lengthincr-6.4mm,-\y mm-.5mm) rectangle ++(\l mm,-.75mm) node[midway,centered,text=\@col,scale=.3] {\textbullet};
                \fi
                \xdef\lengthincr{\the\dimexpr\lengthincr+\l mm+.13mm+\extpadding mm}
            }
        }
        % display, we modify the lower shift to adjust height offset
        \pingu@block[rounded corners=1pt]{\csname pingu@color@laptop#1@display\endcsname}(-6.7mm,.25mm+.05mm) rectangle ++(13.4mm,6.45mm) node[midway,centered,rotate=\@angle+5,text width=13.2mm,align=center,minimum height=6.2mm] {\csname pingu@x@laptop#1@mid\endcsname};
        \scope[shift={(-6.7mm,.25mm+.05mm)}]
            \csname pingu@x@laptop#1@content\endcsname
        \endscope
    \endscope
}