Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \pgfmathsetmacro\myangle{0}
- \xdef\angle{\myangle}
- \begin{animateinline}[controls,autoplay,loop]{15}
- \whiledo{\lengthtest{\angle pt<360pt}}{%
- \begin{tikzpicture}[scale=0.75]
- % fill circle and plot
- \path[use as bounding box] (-5.6,-4.7) rectangle (6.6,4.7);
- \ifthenelse{\lengthtest{\angle pt=90pt}}{}{
- \ifthenelse{\lengthtest{\angle pt=270pt}}{}{
- \fill[blue!50] plot[smooth,domain=0:1.5] (\x-3,{\x*tan(\angle)}) |- (0,0); %goes to; startangle:initialangle:radius; goes from
- \ifthenelse{\lengthtest{\angle pt<90pt}}{\fill[blue!50] plot[smooth,domain=0:\angle] (pi/180*\x,{1.5*tan(\x)}) |- (0,0);}{
- \fill[blue!50] plot[smooth,domain=0:85] (pi/180*\x,{1.5*tan(\x)}) |- (0,0);
- \ifthenelse{\lengthtest{\angle pt<270pt}}{\fill[blue!50] plot[smooth,domain=95:\angle] (pi/180*\x,{1.5*tan(\x)}) |- (9.5*pi/18,0);}{
- \fill[blue!50] plot[smooth,domain=100:265] (pi/180*\x,{1.5*tan(\x)}) |- (9.5*pi/18,0);
- \fill[blue!50] plot[smooth,domain=275:\angle] (pi/180*\x,{1.5*tan(\x)}) |- (27.5*pi/18,0);}}
- % draw connection
- \draw (-1.5,{1.5*tan(\angle)}) circle (3pt) -- (pi/180*\angle,{1.5*tan(\angle)}) circle (3pt);}}
- % draw axes an ticks
- \draw (-5.5,0) -- (7,0);
- \foreach \deg in {45,90,135,180,225,270,315,360}
- \draw (pi/180*\deg,2pt) -- (pi/180*\deg,-2pt) node[below] {$\deg^\circ$};
- \draw (0,-7.6) -- (0,7.6);
- \foreach \y in {-5,-4,-3,-2,-1,-0.5,0.5,1,2,3,4,5}
- \draw (2pt,1.5*\y) -- (-2pt,1.5*\y) node[left] {$\y$};
- %draw blue stick
- \draw[very thick, blue] (-3,0) +(\angle:1.5) -- (-3,0);
- % draw plot and circle outline
- \draw plot[smooth,domain=0:80] (pi/180*\x,{1.5*tan(\x)});
- \draw plot[smooth,domain=100:260] (pi/180*\x,{1.5*tan(\x)});
- \draw plot[smooth,domain=280:360] (pi/180*\x,{1.5*tan(\x)});
- \draw (-3,0) circle (1.5);%
- \pgfmathsetmacro\myangle{\angle+5.0} %myangle can't be used globally
- \xdef\angle{\myangle} %we copy it to global variable
- \end{tikzpicture}
- \ifthenelse{\lengthtest{\angle pt<360pt}}{\newframe}{
- \end{animateinline}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement