<Paramname="Begin JS Experiment"updates="constant"val="// Download the webgazer library and re-download seedrandom.js (since webgazer&#10;// overrides it with a version that conflicts with PsychoJS)&#10;psychoJS.downloadResources([&#10; { name: 'webgazer.js', path: 'js/webgazer-2.0.1.tp.js' },&#10; { name: 'seedrandom.js', path: 'https://cdnjs.cloudflare.com/ajax/libs/seedrandom/3.0.1/seedrandom.min.js' }&#10;]);&#10;// Initialize x and y arrays; we use these to calculate running averages of &#10;// current gaze position; the longer the window, the slower, but more fluent&#10;// the updates&#10;let averagingWindow = 10;&#10;window.xGazes = new Array(averagingWindow ).fill(0);&#10;window.yGazes = new Array(averagingWindow ).fill(0);&#10;&#10;"valType="extendedCode"/>
<Paramname="Begin JS Experiment"updates="constant"val="// Download the webgazer library and re-download seedrandom.js (since webgazer&#10;// overrides it with a version that conflicts with PsychoJS)&#10;psychoJS.downloadResources([&#10; { name: 'webgazer.js', path: 'js/webgazer-1.7.3.js' },&#10; { name: 'seedrandom.js', path: 'https://cdnjs.cloudflare.com/ajax/libs/seedrandom/3.0.1/seedrandom.min.js' }&#10;]);&#10;// Initialize x and y arrays; we use these to calculate running averages of &#10;// current gaze position; the longer the window, the slower, but more fluent&#10;// the updates&#10;let averagingWindow = 10;&#10;window.xGazes = new Array(averagingWindow ).fill(0);&#10;window.yGazes = new Array(averagingWindow ).fill(0);&#10;&#10;"valType="extendedCode"/>
<Paramname="Begin JS Routine"updates="constant"val="// Start eye tracking&#10;window.webgazer&#10; // Called on each eye tracking update&#10; .setGazeListener(function(data, clock) {&#10; if (data !== null) {&#10; // Remove first element from gazes array, add current gaze at the end&#10; window.xGazes.shift();&#10; window.xGazes.push(data.x);&#10; window.yGazes.shift();&#10; window.yGazes.push(data.y);&#10; }&#10; })&#10; .begin();&#10; //.showPredictionPoints(true); &#10;"valType="extendedCode"/>
<Paramname="Begin JS Routine"updates="constant"val="// Show webcam thumbnail&#10;//window.webgazer.params.showVideoPreview = true;&#10;// Start eye tracking&#10;window.webgazer&#10; // Called on each eye tracking update&#10; .setGazeListener(function(data, clock) {&#10; if (data !== null) {&#10; // Remove first element from gazes array, add current gaze at the end&#10; window.xGazes.shift();&#10; window.xGazes.push(data.x);&#10; window.yGazes.shift();&#10; window.yGazes.push(data.y);&#10; }&#10; })&#10; .begin();&#10; //.showPredictionPoints(true); &#10;"valType="extendedCode"/>