| 1 |
\documentclass{standalone} |
| 2 |
\usepackage{svg-animate} |
| 3 |
|
| 4 |
\begin{document} |
| 5 |
\begin{tikzpicture} |
| 6 |
|
| 7 |
\tikzset{/anim/duration=1.5} |
| 8 |
|
| 9 |
%% Housing (static — always visible) |
| 10 |
\fill[black!80, rounded corners=8pt] (-1.4, -4.0) rectangle (1.4, 4.0); |
| 11 |
\fill[black!50, rounded corners=6pt] (-1.2, -3.8) rectangle (1.2, 3.8); |
| 12 |
|
| 13 |
%% Lens covers (static dark glass behind each bulb) |
| 14 |
\foreach \y in {2.2, 0, -2.2} { |
| 15 |
\fill[black!60] (0, \y) circle[radius=0.95]; |
| 16 |
} |
| 17 |
|
| 18 |
|
| 19 |
%% The three lights, one per animation step. |
| 20 |
%% When inactive, opacity=0.08 simulates an unlit bulb seen through dark glass. |
| 21 |
\begin{animate}[inactive opacity=0.08] |
| 22 |
%% Static PDF fallback: show only the red light (one clean frame). |
| 23 |
%% Ignored in SVG mode; in PDF mode \reveal draws nothing so only this appears. |
| 24 |
\noanimate{\fill[red!85!black] (0, 2.2) circle[radius=0.85];} |
| 25 |
|
| 26 |
%% Step 1 -- green (1.5 s) |
| 27 |
\reveal{\fill[green!65!black] (0, -2.2) circle[radius=0.85];} |
| 28 |
|
| 29 |
\animstep[duration=0.5] |
| 30 |
%% Step 2 -- green+amber transition (0.5 s) |
| 31 |
\reveal{\fill[green!65!black] (0, -2.2) circle[radius=0.85];} |
| 32 |
\reveal[blink=0.2]{\fill[orange!90!black] (0, 0.0) circle[radius=0.85];} |
| 33 |
|
| 34 |
\animstep[duration=1.0] |
| 35 |
%% Step 3 -- amber (1.0 s) |
| 36 |
\reveal{\fill[orange!90!black] (0, 0.0) circle[radius=0.85];} |
| 37 |
|
| 38 |
\animstep |
| 39 |
%% Step 4 -- red (1.5 s) |
| 40 |
\reveal{\fill[red!85!black] (0, 2.2) circle[radius=0.85];} |
| 41 |
|
| 42 |
\end{animate} |
| 43 |
|
| 44 |
\end{tikzpicture} |
| 45 |
\end{document} |