ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: MetaPost Animations
Date: Tue, 1 Jan 2013 08:48:48 +0100	[thread overview]
Message-ID: <1D98FE74-A557-43A0-B56A-41BC43F2F348@gmail.com> (raw)
In-Reply-To: <65DA0667-2050-4357-AA2F-1A7770AC0779@me.com>


Am 01.01.2013 um 04:50 schrieb Jeong Dal <haksan@me.com>:

> Dear Wolfgang,
> 
> Thank you for the explanation, and your sample works nicely.
> 
> I  enclosed \processMPbuffer using \startframe and \stopframe as following.
> Then  I got a 'undefined control sequence' error.
> If I use '\framed[]' instead of '\startframe … \stopframe', then it gave all 7 circles of different radius in two pages without error.
> If I add "\startanimation … \stopanimation", the only change is the appearance of menu at the bottom of the last circle.(no animation)
> 
> What is wrong in the code?

1. The \frame and \startframe commands are only available *in* the animation environment where they are locally defined.

2. Although \framed sound similar to \frame there is no relation between both commands.

3. You have to expand the loop value *before* it is passed to metapost, see below.

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

\startuseMPgraphic{circles}{counter}
	path p;
	numeric n, u;
	u := 1cm;
	n:=\MPvar{counter}*u;
	p := fullcircle scaled n;
	draw p;
\stopuseMPgraphic

\starttext
\startanimation[menu=yes]
\dorecurse{7}{%
	\startframe
	\useMPgraphic{circles}{counter=#1}%
	\stopframe}
\stopanimation
\stoptext

4. You can also include the metapost code in the frame but you have to expand the \recurselevel value with the \expanded command (I have to upload a new version of the module first because \startframe isn’t expandable yet).

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

\starttext
\startanimation[menu=yes]
\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

5. Use a PDF viewer with javascript support (e.g. Adobe Reader) to view the animation.

Kind regards and a happy new year,
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
___________________________________________________________________________________

  reply	other threads:[~2013-01-01  7:48 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-01  3:50 Jeong Dal
2013-01-01  7:48 ` Wolfgang Schuster [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-01-01 14:30 Jeong Dal
2013-01-01 15:35 ` Wolfgang Schuster
2013-01-07 16:22   ` Troy Henderson
2013-01-07 16:46     ` Marco Patzer
2013-01-07 17:47       ` Rogers, Michael K
2013-01-07 18:24     ` Alan BRASLAU
2012-12-30 13:19 Jeong Dal
2012-12-30 13:43 ` Wolfgang Schuster
2012-12-28 19:41 Troy Henderson
2012-12-28 20:51 ` Otared Kavian
2012-12-28 21:52 ` Hans Hagen
2012-12-28 23:18   ` Rogers, Michael K
2012-12-28 23:49     ` Troy Henderson
2012-12-29  1:02       ` Rogers, Michael K
2012-12-29  2:55         ` Troy Henderson
2012-12-29  3:49           ` Otared Kavian
2012-12-29  3:52             ` Troy Henderson
2012-12-29 12:47           ` Hans Hagen
2012-12-29 15:42           ` Mojca Miklavec
2012-12-29 16:40             ` Peter Münster
2012-12-29 17:07             ` Tom Fossen
2012-12-30  2:57             ` Troy Henderson
2012-12-30 12:43               ` Mojca Miklavec
2012-12-29 12:41         ` Hans Hagen
2005-07-25 22:03 installing context Stuart Jansen
2005-07-25 22:10 ` Hans Hagen
2005-07-26  4:41   ` Adam Lindsay
2005-07-26  5:58     ` metapost:animations luigi.scarso

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=1D98FE74-A557-43A0-B56A-41BC43F2F348@gmail.com \
    --to=wolfgang.schuster@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).