Hi Jeroen,

Unfortunately I am not familiar with Tikz, since all my documents use what is built-in ConTeXt and Metapost…
That being said I am sure someone on the list can help you with Tikz module.

Best regards: Otared

On 22 Jul 2021, at 14:28, Jeroen <contextntg@gmail.com> wrote:

Hi, both solutions are great! This is what I had in mind, a rolling sine. Is there a way to get the same result with the Tikz module?

\usemodule[animation]
\setupinteraction[state=start]

\starttext

\input tufte

\framed{
\startanimation[menu=yes,framerate=40]
\dorecurse{50}{\expanded
{\startframe
\startMPcode
numeric u, omega, mylength, tt ;
u := 2cm ;
omega := 4 ;
mylength := 3.141596 ;
tt := \recurselevel ;
path p ;
p := (0u,sin(omega*(mylength/100)*tt)*u) for i = 1 upto 100 :
.. (((mylength/100)*i)*u,sin(omega*(mylength/100)*(i + tt))*u)
endfor ;
draw p withpen pencircle scaled .5pt withcolor darkred ;
\stopMPcode
\stopframe}
}
\stopanimation
}

\stoptext

Op wo 21 jul. 2021 om 23:26 schreef Otared Kavian <otared@gmail.com>:
Hi,

I wonder whether something like the following is what you are looking for:

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

Best regards: OK

> On 21 Jul 2021, at 19:44, Jeroen <contextntg@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.alpha@gmail.com>:
> Hi,
>
>> Le 21 juill. 2021 à 10:08, Jeroen <contextntg@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
___________________________________________________________________________________
___________________________________________________________________________________
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
___________________________________________________________________________________