-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmcgurk_test_v2.js
54 lines (45 loc) · 1.22 KB
/
mcgurk_test_v2.js
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
var trialNum=0;
var videos = [];
var N;
function generateVideos() {
var tmp = [];
var mcgTmp = [];
var allStim = newStimArr();
var congruent = allStim[0];
var mcgurk = allStim[1];
var congReps = allStim[2];
var mcgReps = allStim[3];
for(var i = 0; i < congruent.length; i++){
for(var j = 0; j<congReps; j++){
tmp.push(congruent[i]);
}
}
//shuffling congruent stimuli
tmp = shuffle(tmp);
//Generating McGurk sequence and adding congruent stimuli
for(var b = 0; b<mcgReps; b++){
for(var a =0; a<mcgurk.length; a++){
mcgTmp.push(mcgurk[a]);
}
mcgTmp.push(tmp[b]);
}
//shuffling each block
for(var c = 0; c<mcgTmp.length;c+=(mcgReps+1)){
videos.push(shuffle(mcgTmp.slice(c, c+(mcgReps+1))));
}
//Flattening array of arrays
videos = [].concat.apply([], videos);
return videos;
}
function Demo(){
var demoVid = document.getElementById('demoVid');
demoVid.play();
generateVideos();
document.getElementById('start').style.visibility = "visible";
newStimArr();
N = videos.length;
return N;
}
function beginTask(){
document.getElementById('demoButton').style.visibility = "visible";
}