animation trigonometrique

📅 March 01, 2024   |   👁️ Views: 35




Votre navigateur ne supporte pas les PDFs. Voir le Lien de Téléchargement au dessous .

% arara: animate: {density: 160, delay: 8}
%# convert tikz pdf animation to gif
%# convert -density 160 -delay 8 -loop 0 -background white -alpha remove sinus-gif.pdf test.gif

\documentclass[tikz]{standalone}
\usepackage{amsmath,amssymb}
\usepackage{pgfplots}

\pgfplotsset{compat=1.13}
\usepgfplotslibrary{fillbetween}

\begin{document}
\foreach \mainangle [count=\xx, evaluate=\mainangle as \mark using (\mainangle/45)] in {0,5,...,355,360}{
\begin{tikzpicture}
\begin{axis}[
    set layers,
    x=1.5cm,y=1.5cm,
    xmin=-3.7, xmax=8.2,
    ymin=-1.5, ymax=1.5,
    axis lines=center,
    axis on top,
    xtick={2,4,6,8},
    ytick={-1,-.5,.5,1},
    xticklabels={$90^{\circ} (\pi/2)$, $180^{\circ} (\pi)$, $270^{\circ} (3\pi/2)$,$360^{\circ} (2\pi)$},
    xticklabel style={font=\tiny},
    yticklabels={-1,-0.5,0.5,1},
    ylabel={$\sin(x)$}, y label style={anchor=west},
    xlabel={$x$}, x label style={anchor=south},
]
\pgfonlayer{pre main}
\addplot [fill=white] coordinates {(-4,-2) (8.5,-2) (8.5,2) (-4,2)} \closedcycle;
\endpgfonlayer

\path[name path=xaxis] (axis cs:-4,0) -- (axis cs:8,0);
\coordinate (O) at (axis cs:0,0);

% plot and circle
\addplot [samples=100,domain=0:8, name path=myplot](\x,{3 * sin(\x*45)/pi});
\draw[name path=circle] (axis cs:-2.5,0) circle (1.5cm);

% fill in circle and plot
\draw[black,fill=blue!40] (axis cs:-2.5,0) -- (axis cs:-1.5,0) arc (0:\mainangle:1.5cm) coordinate (cc) -- cycle;
\ifnum\mainangle>5
\addplot[blue!30] fill between[of=xaxis and myplot, soft clip={domain=-1:\mark}];
\fi

\path[name path=mark] (axis cs:\mark,-1) -- (axis cs:\mark,1);
\path[name intersections={of=mark and myplot,by=cp}];
% small circles
\draw (cc) circle (3pt);
\draw (cp) circle (3pt);
\draw (cc) -- (cp) -- (cp|-O);

\end{axis}
\end{tikzpicture}}
\end{document}

Related Courses, Exams, and Exercises


Course PDF:

📥 Download animation trigonometrique (PDF)