ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Peter Rolf <indiego@gmx.net>
To: ntg-context@ntg.nl
Subject: Re: issue with JavaScript in Acrobat
Date: Mon, 7 Oct 2019 13:21:16 +0200	[thread overview]
Message-ID: <ae399f45-7871-0f1e-fbfe-2d8d4bffb392@gmx.net> (raw)
In-Reply-To: <23ace626-d7ed-5ea2-8863-0a746a1240ed@gmx.es>

Hi Pablo

Nearly no experience with JavaScript, no working Acrobat version
installed (no testing possible). So take the following with a grain of
salt...

I guess it's just the too small call interval of the "step_clock"
function. Calling it a thousand times per second doesn't seem to work.
If the function is called a hundred times per second only, your clock
counter is also incremented only a hundred times.

I would use a system clock value instead (difference between start time
and current time), so you can limit the call interval to a more
reasonable value (1/10s).


Regards, Peter


Am 06.10.2019 um 21:13 schrieb Pablo Rodriguez:
> Dear list,
>
> I have this minimal sample:
>
>     \setupinteraction[state=start]
>     \setupinteractionscreen[option=max]
>     \startJSpreamble {varia} used now
>     var transitions = [1000,
>     2000,
>     3000,
>     4000,
>     5000,
>     6000,
>     7000,
>     8000,
>     9000];
>
>     var msecs = 0;
>
>     function step_clock() {
>         try { ++msecs ;
>         if ((msecs >= (transitions[this.pageNum]/10)) && ( this.pageNum
> < this.numPages )) { ++this.pageNum; };
>         } catch (e) {}
>     }
>
>     advance = app.setInterval ("step_clock()", 1);
>     advance.count = 0;
>     \stopJSpreamble
>     \starttext
>     \dorecurse{10}{\startTEXpage[pagestate=start, offset=1em]
>         \pagenumber
>     \stopTEXpage}
>     \stoptext
>
> Acrobat is required. And I have an issue with it
>
> Each slide takes a full second (1000 milliseconds). But the conditional
> in step_clock() needs to divide the elements from transitions array by
> ten. Otherwise it is ten times slower.
>
> Am I missing something here? Or why is "step_clock()" ten times slower
> than it should be?
>
> Many thanks for your help,
>
> Pablo
> --
> http://www.ousia.tk
> ___________________________________________________________________________________
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2019-10-07 11:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-06 19:13 Pablo Rodriguez
2019-10-07 11:21 ` Peter Rolf [this message]
2019-10-07 20:16   ` Pablo Rodriguez
2019-10-07 20:43     ` Henning Hraban Ramm
2019-10-08 12:56       ` Pablo Rodriguez

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=ae399f45-7871-0f1e-fbfe-2d8d4bffb392@gmx.net \
    --to=indiego@gmx.net \
    --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).