Advertisement
miklis

Tangentas

Jun 24th, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. \pgfmathsetmacro\myangle{0}
  2. \xdef\angle{\myangle}
  3. \begin{animateinline}[controls,autoplay,loop]{15}
  4. \whiledo{\lengthtest{\angle pt<360pt}}{%
  5. \begin{tikzpicture}[scale=0.75]
  6. % fill circle and plot
  7. \path[use as bounding box] (-5.6,-4.7) rectangle (6.6,4.7);
  8. \ifthenelse{\lengthtest{\angle pt=90pt}}{}{
  9. \ifthenelse{\lengthtest{\angle pt=270pt}}{}{
  10. \fill[blue!50] plot[smooth,domain=0:1.5] (\x-3,{\x*tan(\angle)}) |- (0,0); %goes to; startangle:initialangle:radius; goes from
  11. \ifthenelse{\lengthtest{\angle pt<90pt}}{\fill[blue!50] plot[smooth,domain=0:\angle] (pi/180*\x,{1.5*tan(\x)}) |- (0,0);}{
  12. \fill[blue!50] plot[smooth,domain=0:85] (pi/180*\x,{1.5*tan(\x)}) |- (0,0);
  13. \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);}{
  14. \fill[blue!50] plot[smooth,domain=100:265] (pi/180*\x,{1.5*tan(\x)}) |- (9.5*pi/18,0);
  15. \fill[blue!50] plot[smooth,domain=275:\angle] (pi/180*\x,{1.5*tan(\x)}) |- (27.5*pi/18,0);}}
  16. % draw connection
  17. \draw (-1.5,{1.5*tan(\angle)}) circle (3pt) -- (pi/180*\angle,{1.5*tan(\angle)}) circle (3pt);}}
  18. % draw axes an ticks
  19. \draw (-5.5,0) -- (7,0);
  20. \foreach \deg in {45,90,135,180,225,270,315,360}
  21. \draw (pi/180*\deg,2pt) -- (pi/180*\deg,-2pt) node[below] {$\deg^\circ$};
  22. \draw (0,-7.6) -- (0,7.6);
  23. \foreach \y in {-5,-4,-3,-2,-1,-0.5,0.5,1,2,3,4,5}
  24. \draw (2pt,1.5*\y) -- (-2pt,1.5*\y) node[left] {$\y$};
  25. %draw blue stick
  26. \draw[very thick, blue] (-3,0) +(\angle:1.5) -- (-3,0);
  27. % draw plot and circle outline
  28. \draw plot[smooth,domain=0:80] (pi/180*\x,{1.5*tan(\x)});
  29. \draw plot[smooth,domain=100:260] (pi/180*\x,{1.5*tan(\x)});
  30. \draw plot[smooth,domain=280:360] (pi/180*\x,{1.5*tan(\x)});
  31. \draw (-3,0) circle (1.5);%
  32. \pgfmathsetmacro\myangle{\angle+5.0} %myangle can't be used globally
  33. \xdef\angle{\myangle} %we copy it to global variable
  34. \end{tikzpicture}
  35. \ifthenelse{\lengthtest{\angle pt<360pt}}{\newframe}{
  36. \end{animateinline}
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement