summaryrefslogtreecommitdiff
path: root/info/examples/PSTricks_7_de/35-00-89.ltx1
blob: 56140f18ac89e98c755a0ebf64ad8ebb5baaee1b (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
%% 
%%  Ein Beispiel der DANTE-Edition
%%  
%%  7. Auflage
%% 
%%  Beispiel 35-00-89 auf Seite 854.
%% 
%%  Copyright (C) 2016 Herbert Voss
%% 
%%  It may be distributed and/or modified under the conditions
%%  of the LaTeX Project Public License, either version 1.3
%%  of this license or (at your option) any later version.
%% 
%%  See http://www.latex-project.org/lppl.txt for details.
%% 
%% 
%% ==== 
% Show page(s) 1
%% 
%% 
\documentclass[]{exaarticle}
\pagestyle{empty}
\setlength\textwidth{352.81416pt}
\setlength\parindent{0pt}
%StartShownPreambleCommands
\usepackage[paperwidth=8cm,paperheight=5cm,margin=5mm,dvips]{geometry}
\usepackage{animate}
\usepackage{pstricks-add}
\usepackage{multido}
%StopShownPreambleCommands
\begin{document}
  %-------------------- write timeline file ---------------------%
  \newwrite\TimeLineFile
  \immediate\openout\TimeLineFile=sinus.txt
  \immediate\write\TimeLineFile{::0x0,1}%
  %remaining frames: overlay filled circle at its current postion
  \multido{\i=2+1}{90}{%
    \immediate\write\TimeLineFile{%
      ::\i % put filled circle on top
  }}
  \immediate\closeout\TimeLineFile
  %------------------- assemble animation -----------------------%
  \psset{xunit=\pstRadUnit,dashadjust=false}
  \begin{animateinline}[controls,timeline=sinus.txt,
    begin={\begin{pspicture}(-0.5,-1.5)(6.6,2)},
    end={\end{pspicture}}]{10}
    %---- static material: axes, labels, curve ----%
    \psaxes[trigLabels,trigLabelBase=3]{->}(0,0)(-2mm,-1.5)(6.5,1.5)[t,-90][$y=\sin(t)$,0]
    \psplot[xunit=1cm,linestyle=dashed,algebraic]{0}{\psPiTwo}{sin(x)}
    \newframe
    \multiframe{91}{n=0+4}{\psset{xunit=1cm,linecolor=blue}
      \pscustom[xunit=1cm,fillcolor=blue!30,fillstyle=solid,
        linestyle=none,algebraic,dimen=inner]{%
        \psplot{0}{\n\space DegtoRad}{sin(x)}
        \psline(!\n\space DegtoRad 0)
      }
      \psplot[xunit=1cm,linestyle=dashed,linecolor=black,
         algebraic]{0}{\n\space DegtoRad}{sin(x)}
      \psdot[opacity=0.4,dotsize=3mm](!\n\space dup DegtoRad exch sin)
      \psline[linestyle=dashed](!\n\space dup DegtoRad exch sin)(!\n\space DegtoRad 0)
    }
  \end{animateinline}
\end{document}