If there is an open JS library for it, then it can be imported into PsychoPy and used on pavlovia. This allows a broad range of possibilities for making exciting online studies. You don’t need to be a pro JS coder to use these. Several basic demos are available and a key skill is knowing how to adapt and use these demos. In this exercise, we will focus on how to adapt the eye-tracking demo available on pavlovia.org, which uses the webgazer package for eye tracking.
Some of the tools we can use online:
In your breakout rooms work through this stepby-step guide to implement some adaptations to an eye tracking demo. This builds on the skills we learned from Mouse tracking.
Step 1: Download the demo
Go to the demo and click “download”.
Step 2: Making local edits
OK so now we have our own copy of an eye tracking demo! Let’s make some edits! An important part of this exercise is that we don’t need to know JS in order to use this demo, we just need to know how to navigate code and what is possible. We are going to adapt the ‘tracking_trial’ routine .
Note
Because this uses Javascript code, your local psychopy won’t run it. So, to check your changes have been made you will need to sync it and run it in the browser from pavlovia.
if polygon.contains(tracking_square):
thisCol = 'red'
else:
thisCol = 'white'
$thisCol
with the field set to set every frameif there is time…
Ok imagine we want several trials, where each trial ends when the participant looks at the target.
3. In your ‘checkTarget’ code component make the following edit
if polygon.contains(tracking_square):
thisCol = 'red'
continueRoutine = False
else:
thisCol = 'white'
Additional links