From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/20475 Path: news.gmane.org!not-for-mail From: Willi Egger Newsgroups: gmane.comp.tex.context Subject: Re: Re: Animations in ConTeXt Date: Mon, 23 May 2005 19:54:54 +0200 Message-ID: <429218EE.1040908@boede.nl> References: <1116757157.13109.9.camel@drr.elaphus> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1116871369 18045 80.91.229.2 (23 May 2005 18:02:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 23 May 2005 18:02:49 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Mon May 23 20:02:48 2005 Return-path: Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1DaHDr-0002tA-Nu for gctc-ntg-context-518@m.gmane.org; Mon, 23 May 2005 20:00:15 +0200 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 8E9A61279C; Mon, 23 May 2005 20:01:48 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 17897-06; Mon, 23 May 2005 20:01:48 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 9345E127C1; Mon, 23 May 2005 19:58:25 +0200 (CEST) Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 7442D1279C for ; Mon, 23 May 2005 19:58:23 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 17904-02 for ; Mon, 23 May 2005 19:58:22 +0200 (CEST) Original-Received: from smtp-vbr10.xs4all.nl (smtp-vbr10.xs4all.nl [194.109.24.30]) by ronja.ntg.nl (Postfix) with ESMTP id 0EA2C127D4 for ; Mon, 23 May 2005 19:54:55 +0200 (CEST) Original-Received: from [192.168.0.193] (a80-126-172-1.adsl.xs4all.nl [80.126.172.1]) by smtp-vbr10.xs4all.nl (8.12.11/8.12.11) with ESMTP id j4NHstO8044871 for ; Mon, 23 May 2005 19:54:55 +0200 (CEST) (envelope-from w.egger@boede.nl) User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en Original-To: mailing list for ConTeXt users In-Reply-To: <1116757157.13109.9.camel@drr.elaphus> X-Virus-Scanned: by XS4ALL Virus Scanner X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on smtp.ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:20475 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:20475 Hi Richard, thanks for this example. I tried it and voil=E0! Willi Richard Hirsch wrote: > Richard Rascher-Friesenhausen asked >=20 >>So again. Is it possible to write something like the above animation >=20 > packages=20 >=20 >>in ConTeXt (as a module)? >=20 >=20 > If Acrobat can display them, ConTeXt can generate them. >=20 > Here is a simple example.=20 >=20 > \setupoutput [pdf] > \setupcolors [state=3Dstart] > \setupinteraction [state=3Dstart] > \setuppapersize [S6][S6] >=20 > %% this is just code to get something to animate > \startMPinclusions > picture thearrow, thestar; >=20 > drawarrow (origin--up) scaled 10mm > withpen pencircle scaled 3pt > withcolor .9 red; > setbounds currentpicture to (fullcircle scaled 22mm); >=20 > thearrow:=3D currentpicture scaled 5; > currentpicture:=3D nullpicture; >=20 > for angle=3D0 step 72 until 359: > draw thearrow rotated angle; > endfor >=20 > thestar:=3D currentpicture; > currentpicture:=3D nullpicture > \stopMPinclusions >=20 > \setupMPvariables [drawstar] [rotation=3D0] > \startuniqueMPgraphic{drawstar}{rotation} > draw thestar rotated \MPvar{rotation}; > \stopuniqueMPgraphic >=20 >=20 > %% now we define some symbols (the frames of the animated sequence) > \def\definestarsymbol#1{% > \definesymbol [star #1] [\uniqueMPgraphic{drawstar}{rotation=3D#1}]} >=20 > \definestarsymbol{0} > \definestarsymbol{6} > \definestarsymbol{12} > \definestarsymbol{18} > \definestarsymbol{24} > \definestarsymbol{30} > \definestarsymbol{36} > \definestarsymbol{42} > \definestarsymbol{48} > \definestarsymbol{54} > \definestarsymbol{60} > \definestarsymbol{66} >=20 > %% the frames are put into a fieldstack > \definefieldstack [vortex] > [star 0, star 6, star 12, star 18, star 24, star 30,=20 > star 36, star 42, star 48, star 54, star 60, star 66] >=20 > %% and this is the JavaScrip code that displays the frames one by one > \startJSpreamble MyField used later > var current =3D 1; > var delay =3D 200; % 200 milliseconds > var timer; > var running =3D false; % animation currently not running >=20 > function Advance_Angle ( ) { > this.getField("vortex:"+current).value =3D "Off"; > if (++current > 12) % number of frames > { current =3D 1; } % loop through frames > this.getField("vortex:"+current).value =3D "On"; > } > \stopJSpreamble >=20 > %% we want to control the starting and stopping of the animation > \startJScode Rotate_Star uses MyField > if (running) {=20 > try { app.clearInterval(timer); } catch(except) {}; > running =3D false; > } > else {=20 > timer =3D app.setInterval("Advance_Angle()",delay);=20 > running =3D true; > } > \stopJScode >=20 >=20 > \starttext > \placefigure [here] [fig:animation] > {A simple \MetaFun\ animation, > click \goto {here} [JS(Rotate_Star)] to start (or stop)} > {\fieldstack [vortex]} > \stoptext >=20 > Of course you would want to put the symbol definitions and the > definition of the fieldstack into a loop. I tried=20 > %% \newcount\angle > %% \angle=3D0%\zerocount > %% \dorecurse{12} {% > %% \number\angle:\qquad > %% \definestarsymbol{\the\angle} > %% \symbol[star \number\angle]\par > %% \advance\angle by 6} > and did get the single symbols. I wasn't successful however in putting > the symbol list of the fieldstack definition into a loop. Perhaps the > ConTeXt gurus can help. >=20 > Best regards, >=20 > Richard >=20 > _______________________________________________ > ntg-context mailing list > ntg-context@ntg.nl > http://www.ntg.nl/mailman/listinfo/ntg-context