/
index.html
80 lines (70 loc) · 2.68 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html>
<head>
<script src="jspsych-6.1.0/jspsych.js"></script>
<script src="jspsych-webgazer-calibrate.js"></script>
<script src="jspsych-webgazer-visual-world.js"></script>
<script src="jspsych-6.1.0/plugins/jspsych-html-button-response.js"></script>
<script src="jspsych-6.1.0/plugins/jspsych-html-keyboard-response.js"></script>
<link rel="stylesheet" href="jspsych-6.1.0/css/jspsych.css">
</head>
<body></body>
<script src="js/webgazer.js"></script>
<script>
var timeline = [];
timeline.push({
type: 'html-button-response',
stimulus: '',
choices: ['Begin']
})
timeline.push({
type: 'webgazer-calibrate'
});
var vw_trial = {
type: 'webgazer-visual-world',
audio: jsPsych.timelineVariable('audio'),
image: jsPsych.timelineVariable('image')
}
var response_trial = {
type: 'html-button-response',
stimulus: '<p>Did the audio match the picture?</p>',
choices: ["Yes", "No"],
data: {
audio: jsPsych.timelineVariable('audio'),
image: jsPsych.timelineVariable('image')
}
}
var vw_procedure = {
timeline: [vw_trial, response_trial],
timeline_variables: [
{audio: 'mp3/1f.mp3', image: 'img/Ducks_1f_BMP_result.png', trial_type: 'filler', audio_image_match: 'Yes'},
{audio: 'mp3/2f.mp3', image: 'img/FamilyDance_2f_BMP_result.png', trial_type: 'filler', audio_image_match: 'Yes'},
{audio: 'mp3/3f.mp3', image: 'img/Surf_3f_BMP_result.png', trial_type: 'filler', audio_image_match: 'Yes'},
{audio: 'mp3/4f.mp3', image: 'img/Hockey_4f_BMP_result.png', trial_type: 'filler', audio_image_match: 'Yes'},
{audio: 'mp3/5f.mp3', image: 'img/Hawaii_5f_BMP_result.png', trial_type: 'filler', audio_image_match: 'Yes'},
{audio: 'mp3/6f.mp3', image: 'img/Hanky_6f_BMP_result.png', trial_type: 'filler', audio_image_match: 'Yes'},
{audio: 'mp3/7f.mp3', image: 'img/Donut_7f_BMP_result.png', trial_type: 'filler', audio_image_match: 'Yes'},
{audio: 'mp3/8f.mp3', image: 'img/Stealing_8f_BMP_result.png', trial_type: 'filler', audio_image_match: 'Yes'},
{audio: 'mp3/9f.mp3', image: 'img/Jello_9f_BMP_result.png', trial_type: 'filler', audio_image_match: 'Yes'},
]
}
timeline.push(vw_procedure);
jsPsych.init({
timeline: timeline,
preload_audio: [
'mp3/1f.mp3',
'mp3/2f.mp3',
'mp3/3f.mp3',
'mp3/4f.mp3',
'mp3/5f.mp3',
'mp3/6f.mp3',
'mp3/7f.mp3',
'mp3/8f.mp3',
'mp3/9f.mp3'
],
on_finish: function(){
jsPsych.data.displayData('json')
}
})
</script>
</html>