[NTG-context] issue with JavaScript in Acrobat

Pablo Rodriguez oinos at gmx.es
Sun Oct 6 21:13:24 CEST 2019


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


More information about the ntg-context mailing list