From: Wolfgang Schuster <schuster.wolfgang@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: \startanimation and \dorecurse
Date: Tue, 21 Oct 2014 15:09:07 +0200 [thread overview]
Message-ID: <E77AC83A-50F7-4722-9F08-81544D102046@gmail.com> (raw)
In-Reply-To: <111D677E-1547-40C5-8737-361F16D16FFF@me.com>
> Am 21.10.2014 um 14:08 schrieb Jeong Dal <haksan@me.com>:
>
> Dear Wolfgang,
>
> Thank you for a nice solution.
>
> I applied your method to produce an animation which draw a circle using the following:
>
> %%%%%%%%
> \usemodule[animation]
> \setupinteraction[state=start]
> \startuseMPgraphic{Circles}{s}
> numeric sn, L, N;
> path p, q;
> p := fullcircle scaled 72;
> L:=length p;
> N:=20;
> sn:= \MPvar{s};
> q := subpath (0, sn/N*L) of p;%
> draw q withcolor red;
> fill fullcircle scaled 3 shifted point length q of q withcolor blue;
> setbounds currentpicture to unitsquare shifted (-0.5,-0.5) scaled 75;
> \stopuseMPgraphic
> \starttext
> \startanimation
> \dorecurse{20}
> {\startexpanded
> %\setupMPvariables[Circles][s]
> \useMPgraphic{Circles}{s=\recurselevel}
> \stopexpanded}
> \stopanimation
> \stoptext
> %%%%%%%%%%
>
> However, it just draw 20 figures instead of making an animation.
>
> Would you please tell me what is wrong in the above code?
You have to put each meatiest graphic into a frame, there are three ways to create a frame.
1. Use braces around the frame
\startanimation
{First frame}
{Second frame}
{Third frame}
\stopanimation
This method doesn’t work in your case where you use \dorecurse to create the graphics.
2. Use the \frame command.
\startanimation
\frame{First frame}
\frame{Second frame}
\frame{Third frame}
\stopanimation
In this case the \frame command is used store the content for each frame, this can be used
when you create all frames with a loop like in your case, e.g.
\dorecurse{10}{\expanded{\frame{\useMPPgraphic{…}{var=\recurselevel}}}}
3. Use the \startframe environment.
\startanimation
\startframe First frame \stopframe
\startframe Second frame \stopframe
\startframe Third frame \stopframe
\stopaniamtion
This is the same as the second method except that you use star/stop delimiters
for each frame content instead of putting it into a argument.
Wolfgang
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2014-10-21 13:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.161.1413864303.2277.ntg-context@ntg.nl>
2014-10-21 12:08 ` Jeong Dal
2014-10-21 13:09 ` Wolfgang Schuster [this message]
[not found] <mailman.168.1413928889.2277.ntg-context@ntg.nl>
2014-10-22 8:01 ` Jeong Dal
2014-10-20 11:32 Jeong Dal
2014-10-20 11:54 ` Wolfgang Schuster
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=E77AC83A-50F7-4722-9F08-81544D102046@gmail.com \
--to=schuster.wolfgang@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).