Hi,

Adding to my previous message, if you are looking for an animation of the wave 
equation for a string with fixed endpoints, one has to use something like the 
following:

% begin wave-sine-string.tex
\usemodule[animation]
\setupinteraction[state=start]
\starttext
\startTEXpage[offset=2pt]
\startanimation[menu=yes,framerate=10]
        \dorecurse{101}{\expanded
                {\startframe
                \startMPcode
                        numeric u, omega, mylength, tt, N ;
                        u := 2cm ;
                        omega := 4 ;
                        mylength := 3.141596 ;
                        tt := \recurselevel - 1 ;
                        N := 500 ; % number of steps
                        path p ;
                        p := (0u,0u) for i = 1 upto N : 
                                                        -- 
(((mylength/N)*i)*u,cos(omega*(mylength/N)*tt)*sin(omega*(mylength/N)*i)*u) 
                                        endfor ;
                        draw p withpen pencircle scaled .5pt withcolor darkred ;
                \stopMPcode
                \stopframe}
                }
\stopanimation
\stopTEXpage
\stoptext
% end wave-sine-string.tex

Best regards: OK

> On 21 Jul 2021, at 19:44, Jeroen <context...@gmail.com> wrote:
> 
> I am looking for a sine animation as the one file f.pdf on this site
> 
> http://www.12000.org/my_notes/Mathematica_animation_into_PDF_using_latex/index.htm
> 
> Jeroen
> 
> Op wo 21 jul. 2021 om 17:54 schreef Fabrice L <fabrice.al...@gmail.com>:
> Hi,
> 
>> Le 21 juill. 2021 à 10:08, Jeroen <context...@gmail.com> a écrit :
>> 
>> I use this small animation to enlarge a circle
>> 
>> 
>> \usemodule[animation]
>> \setupinteraction[state=start]
>> \starttext
>> \startanimation[menu=yes,framerate=10]
>> \dorecurse{7}{\expanded
>>   {\startframe
>>     \startMPcode
>>     path p;
>>     numeric n, u;
>>     u := 1cm;
>>     n:=\recurselevel*u;
>>     p := fullcircle scaled n;
>>     draw p;
>>     \stopMPcode
>>   \stopframe}}
>> \stopanimation
>> \stoptext
>> 
>> 
>> This I use to draw a sine
>> 
>> 
>> \starttext
>> \startMPcode
>>   draw(-90/360*1.5cm,-0.9cm) for i = -90 upto 630: .. 
>> (i/360*1.5cm,0.9cm*(sind(i)))endfor;
>> \stopMPcode
>> \stoptext
>> 
>> 
>> When I put it together to animate the sine as following, it does not 
>> entirely create the sine animation I am looking for
>> 
>> 
>> \usemodule[animation]
>> \setupinteraction[state=start]
>> \starttext
>> \startanimation[menu=yes,framerate=10]
>> \dorecurse{7}{\expanded
>>   {\startframe
>>     \startMPcode
>>     path p;
>>     numeric n, u;
>>     u := 1cm;
>>     n:=\recurselevel*u;
>>     p := (-90/360*1.5cm,-0.9cm) for i = -90 upto 630: .. 
>> (i/360*1.5cm,0.9cm*(sind(i))) endfor shifted (n,0);
>>     draw p;
>>     \stopMPcode
>>     \stopframe}}
>> \stopanimation
>> \stoptext
>> 
>> 
>> What better way can I create a sine animation with Metapost?
>>  
>> 
> 
> Here is another way to do your animation. This is doing something, but I 
> guess not what you want. Could you describe what do you have in mind ?
> 
> \starttext
> \dorecurse{7}{ % 3180
> \startMPpage
>       myvariable := #1 ;
>       path p;
>     numeric n, u;
>     u := 1cm;
>     n:=myvariable*u;
>     p := (-90/360*1.5cm,-0.9cm) for i = -90 upto 630: .. 
> (i/360*1.5cm,0.9cm*(sind(i))) endfor shifted (n,0);
>     draw p;
> \stopMPpage
> }
> \stoptext
> 
> Fabrice.
> 
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to