ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Willi Egger <w.egger@boede.nl>
Subject: Re: Re: Animations in ConTeXt
Date: Wed, 25 May 2005 17:32:40 +0200	[thread overview]
Message-ID: <42949A98.8000605@boede.nl> (raw)
In-Reply-To: <6faad9f00505241107123dc407@mail.gmail.com>

Hi Mojca,

this is strange, on my installation with Acrobat 7.0.1 under Windows XP 
both the stepwise and continuous part work properly.

Willi


Mojca Miklavec wrote:
> I don't get it. Examples (animations) on
> http://www.fi.muni.cz/~xholecek/animations/ compile and work OK with
> my TeX and Acrobat (Windows XP, Adobe Acrobat Professional 6.0.1).
> However, the example below doesn't work on my computer.
> 
> I replaced some lines below with:
> 
> \starttext
>   \placefigure [here] [fig:animation]
>   {A simple \MetaFun\ animation,
>   click \goto {here} [JS(Rotate_Star)] to start (or stop) or
>   % this line was added as described in MetaFun manual
>   click \goto {here} [JS(Walk_Field{vortex})] for next step}
>   {\fieldstack [vortex]}
> \stoptext 
> 
> which results in the PDF file attached.
> 
> Stepping in JS(Walk_Field{vortex}) works OK, while continuous
> animation in JS(Rotate_Star) doesn't. Is this because of my (old?)
> ConTeXt distribution (ver 2005.01.31, fmt 2005.5.16), because of my
> (old/buggy?) Acrobat/OS or because of problems in JavaScript?
> 
> Thank you,
>      Mojca
> 
> Willi Egger wrote:
> 
>>Hi Richard,
>>
>>thanks for this example. I tried it and voilà!
>>
>>Willi
>>
>>Richard Hirsch wrote:
>>
>>>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
>>>
>>>Best regards,
>>>
>>>  Richard
>>>
>>>
>>>------------------------------------------------------------------------
>>>
>>>_______________________________________________
>>>ntg-context mailing list
>>>ntg-context@ntg.nl
>>>http://www.ntg.nl/mailman/listinfo/ntg-context

  reply	other threads:[~2005-05-25 15:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-22 10:19 Richard Hirsch
2005-05-23 17:54 ` Willi Egger
2005-05-24 18:07   ` Mojca Miklavec
2005-05-25 15:32     ` Willi Egger [this message]
2005-07-07 15:51     ` Hans Hagen
2005-07-07 16:11       ` Hans Hagen
2005-07-07 21:02       ` Mojca Miklavec
2005-07-07 21:33         ` Hans Hagen
2005-07-08  6:02           ` luigi.scarso
2005-05-24 17:58 ` Mojca Miklavec
2005-05-24 21:52   ` Hans Hagen

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=42949A98.8000605@boede.nl \
    --to=w.egger@boede.nl \
    --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).