Re: [NTG-context] MetaPost Animations
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? Best regards, Dalyoung Happy New Year to all listers!!! %%%%%%%%%%%% \startbuffer[circles] path p; numeric n, u; u := 1cm; n:=\recurselevel*u; p := fullcircle scaled n; draw p; \stopbuffer \usemodule[animation] \setupinteraction[state=start] \starttext %\startanimation[menu=yes] \dorecurse{7}{ \startframe % \framed[]%{\processMPbuffer[circles]}} \processMPbuffer[circles] \stopframe } %\stopanimation \stoptext %%%%%%%%%%%%%%%%%%%%%%%%%%%% ! Undefined control sequence. system > tex > error on line 23 in file test-ani.tex: Undefined control sequence ... 13 \setupinteraction[state=start] 14 15 \starttext 16 17 %\startanimation[menu=yes] 18 \dorecurse{7}{ 19 \startframe 20 % \framed[]%{\processMPbuffer[circles]}} 21 \processMPbuffer[circles] 22 \stopframe 23 >> } 24 %\stopanimation 25 26 \stoptext 27 \12>>1 #1#2-> \startframe \processMPbuffer [circles] \stopframe \syst_helpers_recurse_indeed_yes ...curse_content \syst_helpers_recurse_indeed <to be read again> { <inserted text> 2 \syst_helpers_recurse_indeed ...the \innerrecurse }{#2} l.23 }
Am 01.01.2013 um 04:50 schrieb Jeong Dal
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
participants (2)
-
Jeong Dal
-
Wolfgang Schuster