From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/20462 Path: news.gmane.org!not-for-mail From: Richard Hirsch Newsgroups: gmane.comp.tex.context Subject: Re: Animations in ConTeXt Date: Sun, 22 May 2005 12:19:17 +0200 Message-ID: <1116757157.13109.9.camel@drr.elaphus> Reply-To: tabletten-teilbarkeit@t-online.de, mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1116757304 16226 80.91.229.2 (22 May 2005 10:21:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 22 May 2005 10:21:44 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Sun May 22 12:21:39 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 1DZnaI-0006dR-Rv for gctc-ntg-context-518@m.gmane.org; Sun, 22 May 2005 12:21:26 +0200 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 130EE12796; Sun, 22 May 2005 12:22:41 +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 03653-02; Sun, 22 May 2005 12:22:40 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id A86711278D; Sun, 22 May 2005 12:19:15 +0200 (CEST) Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 4389C1278B for ; Sun, 22 May 2005 12:19:14 +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 03367-04 for ; Sun, 22 May 2005 12:19:13 +0200 (CEST) Original-Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by ronja.ntg.nl (Postfix) with SMTP id 1D9A11277C for ; Sun, 22 May 2005 12:19:13 +0200 (CEST) Original-Received: (qmail invoked by alias); 22 May 2005 10:19:12 -0000 Original-Received: from p54B6BFA0.dip.t-dialin.net (EHLO p54B6BFA0.dip.t-dialin.net) [84.182.191.160] by mail.gmx.net (mp019) with SMTP; 22 May 2005 12:19:12 +0200 X-Authenticated: #4067381 Original-To: ntg-context@ntg.nl X-Mailer: Evolution 2.2.1 X-Y-GMX-Trusted: 0 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:20462 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:20462 Richard Rascher-Friesenhausen asked > So again. Is it possible to write something like the above animation packages > in ConTeXt (as a module)? If Acrobat can display them, ConTeXt can generate them. Here is a simple example. \setupoutput [pdf] \setupcolors [state=start] \setupinteraction [state=start] \setuppapersize [S6][S6] %% this is just code to get something to animate \startMPinclusions picture thearrow, thestar; drawarrow (origin--up) scaled 10mm withpen pencircle scaled 3pt withcolor .9 red; setbounds currentpicture to (fullcircle scaled 22mm); thearrow:= currentpicture scaled 5; currentpicture:= nullpicture; for angle=0 step 72 until 359: draw thearrow rotated angle; endfor thestar:= currentpicture; currentpicture:= nullpicture \stopMPinclusions \setupMPvariables [drawstar] [rotation=0] \startuniqueMPgraphic{drawstar}{rotation} draw thestar rotated \MPvar{rotation}; \stopuniqueMPgraphic %% now we define some symbols (the frames of the animated sequence) \def\definestarsymbol#1{% \definesymbol [star #1] [\uniqueMPgraphic{drawstar}{rotation=#1}]} \definestarsymbol{0} \definestarsymbol{6} \definestarsymbol{12} \definestarsymbol{18} \definestarsymbol{24} \definestarsymbol{30} \definestarsymbol{36} \definestarsymbol{42} \definestarsymbol{48} \definestarsymbol{54} \definestarsymbol{60} \definestarsymbol{66} %% the frames are put into a fieldstack \definefieldstack [vortex] [star 0, star 6, star 12, star 18, star 24, star 30, star 36, star 42, star 48, star 54, star 60, star 66] %% and this is the JavaScrip code that displays the frames one by one \startJSpreamble MyField used later var current = 1; var delay = 200; % 200 milliseconds var timer; var running = false; % animation currently not running function Advance_Angle ( ) { this.getField("vortex:"+current).value = "Off"; if (++current > 12) % number of frames { current = 1; } % loop through frames this.getField("vortex:"+current).value = "On"; } \stopJSpreamble %% we want to control the starting and stopping of the animation \startJScode Rotate_Star uses MyField if (running) { try { app.clearInterval(timer); } catch(except) {}; running = false; } else { timer = app.setInterval("Advance_Angle()",delay); running = true; } \stopJScode \starttext \placefigure [here] [fig:animation] {A simple \MetaFun\ animation, click \goto {here} [JS(Rotate_Star)] to start (or stop)} {\fieldstack [vortex]} \stoptext Of course you would want to put the symbol definitions and the definition of the fieldstack into a loop. I tried %% \newcount\angle %% \angle=0%\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. Best regards, Richard