ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Fabrice L <fabrice.alpha@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Metapost Animation of Sine
Date: Wed, 21 Jul 2021 11:54:48 -0400	[thread overview]
Message-ID: <92E16120-1E0D-4EFF-89EA-1AF088952048@gmail.com> (raw)
In-Reply-To: <CAPtmdbN+B-HHgt_Bdk8JLV3Wre_MBVdiqzBYoVyZ0QS8M6e0PQ@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1843 bytes --]

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.



[-- Attachment #1.2: Type: text/html, Size: 3873 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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	other threads:[~2021-07-21 15:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21 14:08 Jeroen
2021-07-21 15:54 ` Fabrice L [this message]
2021-07-21 17:44   ` Jeroen
2021-07-21 21:26     ` Otared Kavian
2021-07-22 12:28       ` Jeroen
2021-07-22 20:38         ` Otared Kavian
2021-07-21 21:45     ` Otared Kavian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=92E16120-1E0D-4EFF-89EA-1AF088952048@gmail.com \
    --to=fabrice.alpha@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).