From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
Jeong Dal <haksan@me.com>
Subject: Re: weekend upload - stacking and animation
Date: Tue, 13 Jul 2021 15:14:29 +0200 [thread overview]
Message-ID: <bc6b0490-0914-8a28-9179-c97834fb5fe4@xs4all.nl> (raw)
In-Reply-To: <AB628C98-9CB9-4708-8DC3-4ACB54C080EA@me.com>
On 7/13/2021 12:25 PM, Jeong Dal wrote:
> Dear Hans, Aditya,
>
> Now, I understand the stacking method.
> I made a simple animation using it.
>
>
> \startuseMPgraphic{demo}
> for i=1 upto 10:
> draw fullcircle scaled (.3*i*cm) withcolor (.1*i*red) withpen pencircle
> scaled (.5*bp) withstacking i;
> endfor;
> \stopuseMPgraphic
> \setupinteraction[state=start]
> \usemodule[animation]
>
> \starttext
> \startanimation[menu=yes]
> % \dorecurse{10}
> % { {\useMPgraphic[stacking={#1}]{demo}}}
> {\useMPgraphic[stacking={1}]{demo}}
> {\useMPgraphic[stacking={2}]{demo}}
> {\useMPgraphic[stacking={3}]{demo}}
> {\useMPgraphic[stacking={4}]{demo}}
> {\useMPgraphic[stacking={5}]{demo}}
> {\useMPgraphic[stacking={6}]{demo}}
> {\useMPgraphic[stacking={7}]{demo}}
> {\useMPgraphic[stacking={8}]{demo}}
> {\useMPgraphic[stacking={9}]{demo}}
> {\useMPgraphic[stacking={10}]{demo}}
> \stopanimation
> \stoptext
>
>
> However, I cannot succeed to use \dorecurse to make the code simple.
> If there is another good method, please let me know.
>
> Anyway, thanks for this new feature!
How about:
\startuseMPgraphic{demo}
for i=1 upto 10:
draw fullcircle scaled (i*cm/3)
withcolor (i*red/10)
withpen pencircle scaled (bp/2)
withstacking i
;
endfor ;
\stopuseMPgraphic
\unprotect
\tolerant\protected\def\useMPanimation[#1]#2%
{\begingroup
\scratchtoks\emptytoks
\dorecurse{10}{\etoksapp\scratchtoks{{\useMPgraphic[\c!stacking={\recurselevel}]{#2}}}}%
\expanded{\startanimation[#1]\the\scratchtoks\stopanimation}%
\endgroup}
\protect
\setupinteraction[state=start]
\usemodule[animation]
\starttext
\useMPanimation[menu=yes]{demo}
\stoptext
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________
next prev parent reply other threads:[~2021-07-13 13:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.580.1626060721.1143.ntg-context@ntg.nl>
2021-07-12 19:29 ` weekend upload Jeong Dal
2021-07-12 20:00 ` Aditya Mahajan
2021-07-13 10:25 ` weekend upload - stacking and animation Jeong Dal
2021-07-13 13:14 ` Hans Hagen [this message]
2021-07-13 14:11 ` Floris van Manen
2021-07-13 15:02 ` Hans Hagen
2021-07-13 14:59 ` Wolfgang Schuster
2021-07-13 22:34 ` Jeong Dal
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=bc6b0490-0914-8a28-9179-c97834fb5fe4@xs4all.nl \
--to=j.hagen@xs4all.nl \
--cc=haksan@me.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).