Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
D
demo_eye_tracking2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yangyishu
demo_eye_tracking2
Commits
db8170f3
Commit
db8170f3
authored
May 21, 2021
by
Thomas Pronk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
_
parent
83f6b162
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
78 deletions
+50
-78
demo_eye_tracking2-legacy-browsers.js
demo_eye_tracking2-legacy-browsers.js
+19
-33
demo_eye_tracking2.js
demo_eye_tracking2.js
+26
-40
index.html
index.html
+5
-5
No files found.
demo_eye_tracking2-legacy-browsers.js
View file @
db8170f3
...
...
@@ -19,6 +19,7 @@ psychoJS.openWindow({
let
expName
=
'demo_eye_tracking2'
;
// from the Builder filename that created this script
let
expInfo
=
{
'participant'
:
''
,
'session'
:
'001'
};
// Start code blocks for 'Before Experiment'
// schedule the experiment:
psychoJS
.
schedule
(
psychoJS
.
gui
.
DlgFromDict
({
dictionary
:
expInfo
,
...
...
@@ -68,7 +69,7 @@ var frameDur;
function
updateInfo
()
{
expInfo
[
'date'
]
=
util
.
MonotonicClock
.
getDateStr
();
// add a simple timestamp
expInfo
[
'expName'
]
=
expName
;
expInfo
[
'psychopyVersion'
]
=
'202
0.2.5
'
;
expInfo
[
'psychopyVersion'
]
=
'202
1.1.4
'
;
expInfo
[
'OS'
]
=
window
.
navigator
.
platform
;
// store frame rate of monitor if we can measure it successfully
...
...
@@ -197,6 +198,7 @@ function experimentInit() {
var
t
;
var
frameN
;
var
continueRoutine
;
var
loading_trialComponents
;
function
loading_trialRoutineBegin
(
snapshot
)
{
return
function
()
{
...
...
@@ -204,6 +206,7 @@ function loading_trialRoutineBegin(snapshot) {
t
=
0
;
loading_trialClock
.
reset
();
// clock
frameN
=
-
1
;
continueRoutine
=
true
;
// until we're told otherwise
// update component parameters for each repeat
// keep track of which components have finished
loading_trialComponents
=
[];
...
...
@@ -213,19 +216,14 @@ function loading_trialRoutineBegin(snapshot) {
if
(
'status'
in
thisComponent
)
thisComponent
.
status
=
PsychoJS
.
Status
.
NOT_STARTED
;
});
// check if the Routine should terminate
if
(
!
continueRoutine
)
{
// a component has requested a forced-end of Routine
return
Scheduler
.
Event
.
NEXT
;
}
};
return
Scheduler
.
Event
.
NEXT
;
}
}
var
continueRoutine
;
function
loading_trialRoutineEachFrame
(
snapshot
)
{
return
function
()
{
//------Loop for each frame of Routine 'loading_trial'-------
let
continueRoutine
=
true
;
// until we're told otherwise
// get current time
t
=
loading_trialClock
.
getTime
();
frameN
=
frameN
+
1
;
// number of completed frames (so 0 is the first frame)
...
...
@@ -292,11 +290,12 @@ function webcam_trialRoutineBegin(snapshot) {
t
=
0
;
webcam_trialClock
.
reset
();
// clock
frameN
=
-
1
;
continueRoutine
=
true
;
// until we're told otherwise
// update component parameters for each repeat
// Show webcam thumbnail and face feedback box, but not face overlay and gaze dot
window
.
webgazer
.
params
.
showVideoPreview
=
true
;
window
.
webgazer
.
params
.
showFaceFeedbackBox
=
true
;
window
.
webgazer
.
params
.
showFaceOverlay
=
fals
e
;
window
.
webgazer
.
params
.
showFaceOverlay
=
tru
e
;
window
.
webgazer
.
params
.
showGazeDot
=
false
// Start eye tracking
window
.
webgazer
...
...
@@ -321,18 +320,14 @@ function webcam_trialRoutineBegin(snapshot) {
if
(
'status'
in
thisComponent
)
thisComponent
.
status
=
PsychoJS
.
Status
.
NOT_STARTED
;
});
// check if the Routine should terminate
if
(
!
continueRoutine
)
{
// a component has requested a forced-end of Routine
return
Scheduler
.
Event
.
NEXT
;
}
};
return
Scheduler
.
Event
.
NEXT
;
}
}
function
webcam_trialRoutineEachFrame
(
snapshot
)
{
return
function
()
{
//------Loop for each frame of Routine 'webcam_trial'-------
let
continueRoutine
=
true
;
// until we're told otherwise
// get current time
t
=
webcam_trialClock
.
getTime
();
frameN
=
frameN
+
1
;
// number of completed frames (so 0 is the first frame)
...
...
@@ -403,6 +398,7 @@ function intro_calibatrion_trialRoutineBegin(snapshot) {
t
=
0
;
intro_calibatrion_trialClock
.
reset
();
// clock
frameN
=
-
1
;
continueRoutine
=
true
;
// until we're told otherwise
// update component parameters for each repeat
// setup some python lists for storing info about the mouse_2
gotValidClick
=
false
;
// until a click is received
...
...
@@ -415,11 +411,8 @@ function intro_calibatrion_trialRoutineBegin(snapshot) {
if
(
'status'
in
thisComponent
)
thisComponent
.
status
=
PsychoJS
.
Status
.
NOT_STARTED
;
});
// check if the Routine should terminate
if
(
!
continueRoutine
)
{
// a component has requested a forced-end of Routine
return
Scheduler
.
Event
.
NEXT
;
}
};
return
Scheduler
.
Event
.
NEXT
;
}
}
...
...
@@ -428,7 +421,6 @@ var _mouseButtons;
function
intro_calibatrion_trialRoutineEachFrame
(
snapshot
)
{
return
function
()
{
//------Loop for each frame of Routine 'intro_calibatrion_trial'-------
let
continueRoutine
=
true
;
// until we're told otherwise
// get current time
t
=
intro_calibatrion_trialClock
.
getTime
();
frameN
=
frameN
+
1
;
// number of completed frames (so 0 is the first frame)
...
...
@@ -558,6 +550,7 @@ function calibration_trialRoutineBegin(snapshot) {
t
=
0
;
calibration_trialClock
.
reset
();
// clock
frameN
=
-
1
;
continueRoutine
=
true
;
// until we're told otherwise
// update component parameters for each repeat
// setup some python lists for storing info about the mouse_3
mouse_3
.
clicked_name
=
[];
...
...
@@ -583,18 +576,14 @@ function calibration_trialRoutineBegin(snapshot) {
if
(
'status'
in
thisComponent
)
thisComponent
.
status
=
PsychoJS
.
Status
.
NOT_STARTED
;
});
// check if the Routine should terminate
if
(
!
continueRoutine
)
{
// a component has requested a forced-end of Routine
return
Scheduler
.
Event
.
NEXT
;
}
};
return
Scheduler
.
Event
.
NEXT
;
}
}
function
calibration_trialRoutineEachFrame
(
snapshot
)
{
return
function
()
{
//------Loop for each frame of Routine 'calibration_trial'-------
let
continueRoutine
=
true
;
// until we're told otherwise
// get current time
t
=
calibration_trialClock
.
getTime
();
frameN
=
frameN
+
1
;
// number of completed frames (so 0 is the first frame)
...
...
@@ -716,6 +705,7 @@ function tracking_trialRoutineBegin(snapshot) {
t
=
0
;
tracking_trialClock
.
reset
();
// clock
frameN
=
-
1
;
continueRoutine
=
true
;
// until we're told otherwise
// update component parameters for each repeat
// Remove the click tracker used for calibration
window
.
webgazer
.
removeMouseEventListeners
();
...
...
@@ -727,18 +717,14 @@ function tracking_trialRoutineBegin(snapshot) {
if
(
'status'
in
thisComponent
)
thisComponent
.
status
=
PsychoJS
.
Status
.
NOT_STARTED
;
});
// check if the Routine should terminate
if
(
!
continueRoutine
)
{
// a component has requested a forced-end of Routine
return
Scheduler
.
Event
.
NEXT
;
}
};
return
Scheduler
.
Event
.
NEXT
;
}
}
function
tracking_trialRoutineEachFrame
(
snapshot
)
{
return
function
()
{
//------Loop for each frame of Routine 'tracking_trial'-------
let
continueRoutine
=
true
;
// until we're told otherwise
// get current time
t
=
tracking_trialClock
.
getTime
();
frameN
=
frameN
+
1
;
// number of completed frames (so 0 is the first frame)
...
...
demo_eye_tracking2.js
View file @
db8170f3
...
...
@@ -2,13 +2,13 @@
* Demo_Eye_Tracking2 Test *
***************************/
import
{
PsychoJS
}
from
'./lib/core-202
0.2
.js'
;
import
*
as
core
from
'./lib/core-202
0.2
.js'
;
import
{
TrialHandler
}
from
'./lib/data-202
0.2
.js'
;
import
{
Scheduler
}
from
'./lib/util-202
0.2
.js'
;
import
*
as
visual
from
'./lib/visual-202
0.2
.js'
;
import
*
as
sound
from
'./lib/sound-202
0.2
.js'
;
import
*
as
util
from
'./lib/util-202
0.2
.js'
;
import
{
PsychoJS
}
from
'./lib/core-202
1.1.4
.js'
;
import
*
as
core
from
'./lib/core-202
1.1.4
.js'
;
import
{
TrialHandler
}
from
'./lib/data-202
1.1.4
.js'
;
import
{
Scheduler
}
from
'./lib/util-202
1.1.4
.js'
;
import
*
as
visual
from
'./lib/visual-202
1.1.4
.js'
;
import
*
as
sound
from
'./lib/sound-202
1.1.4
.js'
;
import
*
as
util
from
'./lib/util-202
1.1.4
.js'
;
//some handy aliases as in the psychopy scripts;
const
{
abs
,
sin
,
cos
,
PI
:
pi
,
sqrt
}
=
Math
;
const
{
round
}
=
util
;
...
...
@@ -30,6 +30,7 @@ psychoJS.openWindow({
let
expName
=
'demo_eye_tracking2'
;
// from the Builder filename that created this script
let
expInfo
=
{
'participant'
:
''
,
'session'
:
'001'
};
// Start code blocks for 'Before Experiment'
// schedule the experiment:
psychoJS
.
schedule
(
psychoJS
.
gui
.
DlgFromDict
({
dictionary
:
expInfo
,
...
...
@@ -79,7 +80,7 @@ var frameDur;
function
updateInfo
()
{
expInfo
[
'date'
]
=
util
.
MonotonicClock
.
getDateStr
();
// add a simple timestamp
expInfo
[
'expName'
]
=
expName
;
expInfo
[
'psychopyVersion'
]
=
'202
0.2.5
'
;
expInfo
[
'psychopyVersion'
]
=
'202
1.1.4
'
;
expInfo
[
'OS'
]
=
window
.
navigator
.
platform
;
// store frame rate of monitor if we can measure it successfully
...
...
@@ -208,6 +209,7 @@ function experimentInit() {
var
t
;
var
frameN
;
var
continueRoutine
;
var
loading_trialComponents
;
function
loading_trialRoutineBegin
(
snapshot
)
{
return
function
()
{
...
...
@@ -215,6 +217,7 @@ function loading_trialRoutineBegin(snapshot) {
t
=
0
;
loading_trialClock
.
reset
();
// clock
frameN
=
-
1
;
continueRoutine
=
true
;
// until we're told otherwise
// update component parameters for each repeat
// keep track of which components have finished
loading_trialComponents
=
[];
...
...
@@ -223,19 +226,14 @@ function loading_trialRoutineBegin(snapshot) {
for
(
const
thisComponent
of
loading_trialComponents
)
if
(
'status'
in
thisComponent
)
thisComponent
.
status
=
PsychoJS
.
Status
.
NOT_STARTED
;
// check if the Routine should terminate
if
(
!
continueRoutine
)
{
// a component has requested a forced-end of Routine
return
Scheduler
.
Event
.
NEXT
;
}
};
return
Scheduler
.
Event
.
NEXT
;
}
}
var
continueRoutine
;
function
loading_trialRoutineEachFrame
(
snapshot
)
{
return
function
()
{
//------Loop for each frame of Routine 'loading_trial'-------
let
continueRoutine
=
true
;
// until we're told otherwise
// get current time
t
=
loading_trialClock
.
getTime
();
frameN
=
frameN
+
1
;
// number of completed frames (so 0 is the first frame)
...
...
@@ -302,11 +300,12 @@ function webcam_trialRoutineBegin(snapshot) {
t
=
0
;
webcam_trialClock
.
reset
();
// clock
frameN
=
-
1
;
continueRoutine
=
true
;
// until we're told otherwise
// update component parameters for each repeat
// Show webcam thumbnail and face feedback box, but not face overlay and gaze dot
window
.
webgazer
.
params
.
showVideoPreview
=
true
;
window
.
webgazer
.
params
.
showFaceFeedbackBox
=
true
;
window
.
webgazer
.
params
.
showFaceOverlay
=
fals
e
;
window
.
webgazer
.
params
.
showFaceOverlay
=
tru
e
;
window
.
webgazer
.
params
.
showGazeDot
=
false
// Start eye tracking
window
.
webgazer
...
...
@@ -330,18 +329,14 @@ function webcam_trialRoutineBegin(snapshot) {
for
(
const
thisComponent
of
webcam_trialComponents
)
if
(
'status'
in
thisComponent
)
thisComponent
.
status
=
PsychoJS
.
Status
.
NOT_STARTED
;
// check if the Routine should terminate
if
(
!
continueRoutine
)
{
// a component has requested a forced-end of Routine
return
Scheduler
.
Event
.
NEXT
;
}
};
return
Scheduler
.
Event
.
NEXT
;
}
}
function
webcam_trialRoutineEachFrame
(
snapshot
)
{
return
function
()
{
//------Loop for each frame of Routine 'webcam_trial'-------
let
continueRoutine
=
true
;
// until we're told otherwise
// get current time
t
=
webcam_trialClock
.
getTime
();
frameN
=
frameN
+
1
;
// number of completed frames (so 0 is the first frame)
...
...
@@ -412,6 +407,7 @@ function intro_calibatrion_trialRoutineBegin(snapshot) {
t
=
0
;
intro_calibatrion_trialClock
.
reset
();
// clock
frameN
=
-
1
;
continueRoutine
=
true
;
// until we're told otherwise
// update component parameters for each repeat
// setup some python lists for storing info about the mouse_2
gotValidClick
=
false
;
// until a click is received
...
...
@@ -423,11 +419,8 @@ function intro_calibatrion_trialRoutineBegin(snapshot) {
for
(
const
thisComponent
of
intro_calibatrion_trialComponents
)
if
(
'status'
in
thisComponent
)
thisComponent
.
status
=
PsychoJS
.
Status
.
NOT_STARTED
;
// check if the Routine should terminate
if
(
!
continueRoutine
)
{
// a component has requested a forced-end of Routine
return
Scheduler
.
Event
.
NEXT
;
}
};
return
Scheduler
.
Event
.
NEXT
;
}
}
...
...
@@ -436,7 +429,6 @@ var _mouseButtons;
function
intro_calibatrion_trialRoutineEachFrame
(
snapshot
)
{
return
function
()
{
//------Loop for each frame of Routine 'intro_calibatrion_trial'-------
let
continueRoutine
=
true
;
// until we're told otherwise
// get current time
t
=
intro_calibatrion_trialClock
.
getTime
();
frameN
=
frameN
+
1
;
// number of completed frames (so 0 is the first frame)
...
...
@@ -565,6 +557,7 @@ function calibration_trialRoutineBegin(snapshot) {
t
=
0
;
calibration_trialClock
.
reset
();
// clock
frameN
=
-
1
;
continueRoutine
=
true
;
// until we're told otherwise
// update component parameters for each repeat
// setup some python lists for storing info about the mouse_3
mouse_3
.
clicked_name
=
[];
...
...
@@ -589,18 +582,14 @@ function calibration_trialRoutineBegin(snapshot) {
for
(
const
thisComponent
of
calibration_trialComponents
)
if
(
'status'
in
thisComponent
)
thisComponent
.
status
=
PsychoJS
.
Status
.
NOT_STARTED
;
// check if the Routine should terminate
if
(
!
continueRoutine
)
{
// a component has requested a forced-end of Routine
return
Scheduler
.
Event
.
NEXT
;
}
};
return
Scheduler
.
Event
.
NEXT
;
}
}
function
calibration_trialRoutineEachFrame
(
snapshot
)
{
return
function
()
{
//------Loop for each frame of Routine 'calibration_trial'-------
let
continueRoutine
=
true
;
// until we're told otherwise
// get current time
t
=
calibration_trialClock
.
getTime
();
frameN
=
frameN
+
1
;
// number of completed frames (so 0 is the first frame)
...
...
@@ -722,6 +711,7 @@ function tracking_trialRoutineBegin(snapshot) {
t
=
0
;
tracking_trialClock
.
reset
();
// clock
frameN
=
-
1
;
continueRoutine
=
true
;
// until we're told otherwise
// update component parameters for each repeat
// Remove the click tracker used for calibration
window
.
webgazer
.
removeMouseEventListeners
();
...
...
@@ -732,18 +722,14 @@ function tracking_trialRoutineBegin(snapshot) {
for
(
const
thisComponent
of
tracking_trialComponents
)
if
(
'status'
in
thisComponent
)
thisComponent
.
status
=
PsychoJS
.
Status
.
NOT_STARTED
;
// check if the Routine should terminate
if
(
!
continueRoutine
)
{
// a component has requested a forced-end of Routine
return
Scheduler
.
Event
.
NEXT
;
}
};
return
Scheduler
.
Event
.
NEXT
;
}
}
function
tracking_trialRoutineEachFrame
(
snapshot
)
{
return
function
()
{
//------Loop for each frame of Routine 'tracking_trial'-------
let
continueRoutine
=
true
;
// until we're told otherwise
// get current time
t
=
tracking_trialClock
.
getTime
();
frameN
=
frameN
+
1
;
// number of completed frames (so 0 is the first frame)
...
...
index.html
View file @
db8170f3
...
...
@@ -8,7 +8,7 @@
<!-- styles -->
<link
rel=
"stylesheet"
href=
"https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css"
>
<link
rel=
"stylesheet"
href=
"https://lib.pavlovia.org/psychojs-202
0.2
.css"
>
<link
rel=
"stylesheet"
href=
"https://lib.pavlovia.org/psychojs-202
1.1.4
.css"
>
</head>
<body>
...
...
@@ -18,13 +18,13 @@
<script
type=
"text/javascript"
src=
"https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdnjs.cloudflare.com/ajax/libs/seedrandom/3.0.1/seedrandom.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdn
js.cloudflare.com/ajax/libs/pixi.js/5.3.3/pixi
.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdn
.jsdelivr.net/npm/pixi.js-legacy@5.3.3/dist/pixi-legacy
.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdnjs.cloudflare.com/ajax/libs/PreloadJS/1.0.1/preloadjs.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.1
4.2
/xlsx.full.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.1
6.7
/xlsx.full.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdnjs.cloudflare.com/ajax/libs/log4javascript/1.4.9/log4javascript.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdnjs.cloudflare.com/ajax/libs/tone/14.7.61/Tone.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdnjs.cloudflare.com/ajax/libs/howler/2.
1.2
/howler.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdnjs.cloudflare.com/ajax/libs/howler/2.
2.1
/howler.min.js"
></script>
<script
type=
"text/javascript"
src=
"https://cdnjs.cloudflare.com/ajax/libs/pako/1.0.10/pako.min.js"
></script>
<!-- experiment -->
...
...
@@ -33,7 +33,7 @@
<!-- legacy browsers -->
<script
nomodule
type=
"text/javascript"
src=
"https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.6.0/polyfill.min.js"
></script>
<script
nomodule
type=
"text/javascript"
src=
"https://cdnjs.cloudflare.com/ajax/libs/url-search-params/1.1.0/url-search-params.js"
></script>
<script
nomodule
type=
"text/javascript"
src=
"https://lib.pavlovia.org/psychojs-202
0.2
.js"
></script>
<script
nomodule
type=
"text/javascript"
src=
"https://lib.pavlovia.org/psychojs-202
1.1.4
.js"
></script>
<script
nomodule
type=
"text/javascript"
src=
"./demo_eye_tracking2-legacy-browsers.js"
></script>
</body>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment