-
Notifications
You must be signed in to change notification settings - Fork 0
/
Masks&Faces-legacy-browsers.js
3434 lines (3008 loc) · 129 KB
/
Masks&Faces-legacy-browsers.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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/********************
* Masks&Faces Test *
********************/
// init psychoJS:
const psychoJS = new PsychoJS({
debug: true
});
// open window:
psychoJS.openWindow({
fullscr: true,
color: new util.Color([0, 0, 0]),
units: 'height',
waitBlanking: true
});
// store info about the experiment session:
let expName = 'Effects of Varying Facial Region Visibility on Perception';
let expInfo = {'participant': ''};
// Start code blocks for 'Before Experiment'
// schedule the experiment:
psychoJS.schedule(psychoJS.gui.DlgFromDict({
dictionary: expInfo,
title: expName
}));
const flowScheduler = new Scheduler(psychoJS);
const dialogCancelScheduler = new Scheduler(psychoJS);
psychoJS.scheduleCondition(function() { return (psychoJS.gui.dialogComponent.button === 'OK'); }, flowScheduler, dialogCancelScheduler);
// flowScheduler gets run if the participants presses OK
flowScheduler.add(updateInfo); // add timeStamp
flowScheduler.add(experimentInit);
flowScheduler.add(Pre_Virtual_Chin_RestRoutineBegin());
flowScheduler.add(Pre_Virtual_Chin_RestRoutineEachFrame());
flowScheduler.add(Pre_Virtual_Chin_RestRoutineEnd());
flowScheduler.add(Instructions_CreditCard_RoutineBegin());
flowScheduler.add(Instructions_CreditCard_RoutineEachFrame());
flowScheduler.add(Instructions_CreditCard_RoutineEnd());
flowScheduler.add(CreditCardResizeRoutineBegin());
flowScheduler.add(CreditCardResizeRoutineEachFrame());
flowScheduler.add(CreditCardResizeRoutineEnd());
flowScheduler.add(Instructions_BlindSpotRoutineBegin());
flowScheduler.add(Instructions_BlindSpotRoutineEachFrame());
flowScheduler.add(Instructions_BlindSpotRoutineEnd());
const trialsLoopScheduler = new Scheduler(psychoJS);
flowScheduler.add(trialsLoopBegin, trialsLoopScheduler);
flowScheduler.add(trialsLoopScheduler);
flowScheduler.add(trialsLoopEnd);
flowScheduler.add(Post_Virtual_Chin_RestRoutineBegin());
flowScheduler.add(Post_Virtual_Chin_RestRoutineEachFrame());
flowScheduler.add(Post_Virtual_Chin_RestRoutineEnd());
flowScheduler.add(InstructionsRoutineBegin());
flowScheduler.add(InstructionsRoutineEachFrame());
flowScheduler.add(InstructionsRoutineEnd());
flowScheduler.add(Instructions_2RoutineBegin());
flowScheduler.add(Instructions_2RoutineEachFrame());
flowScheduler.add(Instructions_2RoutineEnd());
const Face1LoopScheduler = new Scheduler(psychoJS);
flowScheduler.add(Face1LoopBegin, Face1LoopScheduler);
flowScheduler.add(Face1LoopScheduler);
flowScheduler.add(Face1LoopEnd);
const Face2LoopScheduler = new Scheduler(psychoJS);
flowScheduler.add(Face2LoopBegin, Face2LoopScheduler);
flowScheduler.add(Face2LoopScheduler);
flowScheduler.add(Face2LoopEnd);
flowScheduler.add(Instructions_5RoutineBegin());
flowScheduler.add(Instructions_5RoutineEachFrame());
flowScheduler.add(Instructions_5RoutineEnd());
flowScheduler.add(Instructions_6RoutineBegin());
flowScheduler.add(Instructions_6RoutineEachFrame());
flowScheduler.add(Instructions_6RoutineEnd());
flowScheduler.add(Instructions_7RoutineBegin());
flowScheduler.add(Instructions_7RoutineEachFrame());
flowScheduler.add(Instructions_7RoutineEnd());
flowScheduler.add(Instructions_8RoutineBegin());
flowScheduler.add(Instructions_8RoutineEachFrame());
flowScheduler.add(Instructions_8RoutineEnd());
const LearnUpLoopScheduler = new Scheduler(psychoJS);
flowScheduler.add(LearnUpLoopBegin, LearnUpLoopScheduler);
flowScheduler.add(LearnUpLoopScheduler);
flowScheduler.add(LearnUpLoopEnd);
const LearnInLoopScheduler = new Scheduler(psychoJS);
flowScheduler.add(LearnInLoopBegin, LearnInLoopScheduler);
flowScheduler.add(LearnInLoopScheduler);
flowScheduler.add(LearnInLoopEnd);
flowScheduler.add(Pre_ExperimentRoutineBegin());
flowScheduler.add(Pre_ExperimentRoutineEachFrame());
flowScheduler.add(Pre_ExperimentRoutineEnd());
const ExperimentUpLoopScheduler = new Scheduler(psychoJS);
flowScheduler.add(ExperimentUpLoopBegin, ExperimentUpLoopScheduler);
flowScheduler.add(ExperimentUpLoopScheduler);
flowScheduler.add(ExperimentUpLoopEnd);
const ExperimentInLoopScheduler = new Scheduler(psychoJS);
flowScheduler.add(ExperimentInLoopBegin, ExperimentInLoopScheduler);
flowScheduler.add(ExperimentInLoopScheduler);
flowScheduler.add(ExperimentInLoopEnd);
flowScheduler.add(DebreifingRoutineBegin());
flowScheduler.add(DebreifingRoutineEachFrame());
flowScheduler.add(DebreifingRoutineEnd());
flowScheduler.add(quitPsychoJS, '', true);
// quit if user presses Cancel in dialog box:
dialogCancelScheduler.add(quitPsychoJS, '', false);
psychoJS.start({
expName: expName,
expInfo: expInfo,
resources: [
{'name': 'images/m5.png', 'path': 'images/m5.png'},
{'name': 'images/f3.png', 'path': 'images/f3.png'},
{'name': 'images/f3 blur.png', 'path': 'images/f3 blur.png'},
{'name': 'images/f5 blur.png', 'path': 'images/f5 blur.png'},
{'name': 'Option.Test.Up.A.xlsx', 'path': 'Option.Test.Up.A.xlsx'},
{'name': 'images/m3 mask.png', 'path': 'images/m3 mask.png'},
{'name': 'images/Af4 blurIn.png', 'path': 'images/Af4 blurIn.png'},
{'name': 'images/m2 mask.png', 'path': 'images/m2 mask.png'},
{'name': 'Option.Up.A.xlsx', 'path': 'Option.Up.A.xlsx'},
{'name': 'images/f5In.png', 'path': 'images/f5In.png'},
{'name': 'images/f4 maskIn.png', 'path': 'images/f4 maskIn.png'},
{'name': 'images/Af1.png', 'path': 'images/Af1.png'},
{'name': 'images/f4 blurIn.png', 'path': 'images/f4 blurIn.png'},
{'name': 'images/m2 maskIn.png', 'path': 'images/m2 maskIn.png'},
{'name': 'image.1.A.xlsx', 'path': 'image.1.A.xlsx'},
{'name': 'Option.Test.Up.C.xlsx', 'path': 'Option.Test.Up.C.xlsx'},
{'name': 'images/m1 blurIn.png', 'path': 'images/m1 blurIn.png'},
{'name': 'images/m5 blurIn.png', 'path': 'images/m5 blurIn.png'},
{'name': 'images/f4 mask.png', 'path': 'images/f4 mask.png'},
{'name': 'image.1.B.xlsx', 'path': 'image.1.B.xlsx'},
{'name': 'images/m5 mask.png', 'path': 'images/m5 mask.png'},
{'name': 'image.2.B.xlsx', 'path': 'image.2.B.xlsx'},
{'name': 'images/Af2In.png', 'path': 'images/Af2In.png'},
{'name': 'images/Af1In.png', 'path': 'images/Af1In.png'},
{'name': 'images/m3 blur.png', 'path': 'images/m3 blur.png'},
{'name': 'images/m1.png', 'path': 'images/m1.png'},
{'name': 'images/Af3.png', 'path': 'images/Af3.png'},
{'name': 'Option.In.C.xlsx', 'path': 'Option.In.C.xlsx'},
{'name': 'image.2.C.xlsx', 'path': 'image.2.C.xlsx'},
{'name': 'images/Af1 blur.png', 'path': 'images/Af1 blur.png'},
{'name': 'images/f3In.png', 'path': 'images/f3In.png'},
{'name': 'images/m1 maskIn.png', 'path': 'images/m1 maskIn.png'},
{'name': 'images/f1 blurIn.png', 'path': 'images/f1 blurIn.png'},
{'name': 'images/m5In.png', 'path': 'images/m5In.png'},
{'name': 'images/f1 mask.png', 'path': 'images/f1 mask.png'},
{'name': 'images/Af5.png', 'path': 'images/Af5.png'},
{'name': 'images/m1 blur.png', 'path': 'images/m1 blur.png'},
{'name': 'images/m3 blurIn.png', 'path': 'images/m3 blurIn.png'},
{'name': 'images/Af5 blurIn.png', 'path': 'images/Af5 blurIn.png'},
{'name': 'images/Af4 mask.png', 'path': 'images/Af4 mask.png'},
{'name': 'images/f4.png', 'path': 'images/f4.png'},
{'name': 'images/f4 blur.png', 'path': 'images/f4 blur.png'},
{'name': 'images/f3 mask.png', 'path': 'images/f3 mask.png'},
{'name': 'images/Af3 blur.png', 'path': 'images/Af3 blur.png'},
{'name': 'images/Af5 mask.png', 'path': 'images/Af5 mask.png'},
{'name': 'images/Af5In.png', 'path': 'images/Af5In.png'},
{'name': 'images/m4 blur.png', 'path': 'images/m4 blur.png'},
{'name': 'images/Af4.png', 'path': 'images/Af4.png'},
{'name': 'images/Af2.png', 'path': 'images/Af2.png'},
{'name': 'images/Af1 blurIn.png', 'path': 'images/Af1 blurIn.png'},
{'name': 'Option.Test.In.B.xlsx', 'path': 'Option.Test.In.B.xlsx'},
{'name': 'images/Af4In.png', 'path': 'images/Af4In.png'},
{'name': 'images/Af3In.png', 'path': 'images/Af3In.png'},
{'name': 'images/Af2 mask.png', 'path': 'images/Af2 mask.png'},
{'name': 'images/m3.png', 'path': 'images/m3.png'},
{'name': 'images/f2 mask.png', 'path': 'images/f2 mask.png'},
{'name': 'images/f2 maskIn.png', 'path': 'images/f2 maskIn.png'},
{'name': 'images/m3 maskIn.png', 'path': 'images/m3 maskIn.png'},
{'name': 'image.1.C.xlsx', 'path': 'image.1.C.xlsx'},
{'name': 'images/Af1 mask.png', 'path': 'images/Af1 mask.png'},
{'name': 'images/f5 mask.png', 'path': 'images/f5 mask.png'},
{'name': 'Option.In.A.xlsx', 'path': 'Option.In.A.xlsx'},
{'name': 'images/f4In.png', 'path': 'images/f4In.png'},
{'name': 'images/Af1 maskIn.png', 'path': 'images/Af1 maskIn.png'},
{'name': 'Option.Up.B.xlsx', 'path': 'Option.Up.B.xlsx'},
{'name': 'images/m4 maskIn.png', 'path': 'images/m4 maskIn.png'},
{'name': 'images/m3In.png', 'path': 'images/m3In.png'},
{'name': 'images/m4 mask.png', 'path': 'images/m4 mask.png'},
{'name': 'images/Af3 mask.png', 'path': 'images/Af3 mask.png'},
{'name': 'images/f1 blur.png', 'path': 'images/f1 blur.png'},
{'name': 'images/m1 mask.png', 'path': 'images/m1 mask.png'},
{'name': 'images/m5 maskIn.png', 'path': 'images/m5 maskIn.png'},
{'name': 'images/f5 maskIn.png', 'path': 'images/f5 maskIn.png'},
{'name': 'images/Af5 blur.png', 'path': 'images/Af5 blur.png'},
{'name': 'images/m1In.png', 'path': 'images/m1In.png'},
{'name': 'images/Af2 maskIn.png', 'path': 'images/Af2 maskIn.png'},
{'name': 'images/m2 blur.png', 'path': 'images/m2 blur.png'},
{'name': 'images/f5 blurIn.png', 'path': 'images/f5 blurIn.png'},
{'name': 'images/f1.png', 'path': 'images/f1.png'},
{'name': 'images/m2 blurIn.png', 'path': 'images/m2 blurIn.png'},
{'name': 'images/Af4 maskIn.png', 'path': 'images/Af4 maskIn.png'},
{'name': 'images/f2In.png', 'path': 'images/f2In.png'},
{'name': 'images/f1In.png', 'path': 'images/f1In.png'},
{'name': 'images/m4.png', 'path': 'images/m4.png'},
{'name': 'images/Af5 maskIn.png', 'path': 'images/Af5 maskIn.png'},
{'name': 'images/image12.B.png', 'path': 'images/image12.B.png'},
{'name': 'images/m5 blur.png', 'path': 'images/m5 blur.png'},
{'name': 'images/Af3 maskIn.png', 'path': 'images/Af3 maskIn.png'},
{'name': 'Option.Test.In.C.xlsx', 'path': 'Option.Test.In.C.xlsx'},
{'name': 'image.2.A.xlsx', 'path': 'image.2.A.xlsx'},
{'name': 'images/image12.A.png', 'path': 'images/image12.A.png'},
{'name': 'images/Af2 blurIn.png', 'path': 'images/Af2 blurIn.png'},
{'name': 'Option.In.B.xlsx', 'path': 'Option.In.B.xlsx'},
{'name': 'Option.Test.Up.B.xlsx', 'path': 'Option.Test.Up.B.xlsx'},
{'name': 'images/Af4 blur.png', 'path': 'images/Af4 blur.png'},
{'name': 'images/m4In.png', 'path': 'images/m4In.png'},
{'name': 'images/f3 maskIn.png', 'path': 'images/f3 maskIn.png'},
{'name': 'Option.Test.In.A.xlsx', 'path': 'Option.Test.In.A.xlsx'},
{'name': 'images/m4 blurIn.png', 'path': 'images/m4 blurIn.png'},
{'name': 'images/Af3 blurIn.png', 'path': 'images/Af3 blurIn.png'},
{'name': 'images/f3 blurIn.png', 'path': 'images/f3 blurIn.png'},
{'name': 'images/f2.png', 'path': 'images/f2.png'},
{'name': 'images/f2 blur.png', 'path': 'images/f2 blur.png'},
{'name': 'images/fixation.png', 'path': 'images/fixation.png'},
{'name': 'Option.Up.C.xlsx', 'path': 'Option.Up.C.xlsx'},
{'name': 'images/f1 maskIn.png', 'path': 'images/f1 maskIn.png'},
{'name': 'images/m2In.png', 'path': 'images/m2In.png'},
{'name': 'images/f5.png', 'path': 'images/f5.png'},
{'name': 'images/image12.C.png', 'path': 'images/image12.C.png'},
{'name': 'images/Af2 blur.png', 'path': 'images/Af2 blur.png'},
{'name': 'images/f2 blurIn.png', 'path': 'images/f2 blurIn.png'},
{'name': 'images/m2.png', 'path': 'images/m2.png'}
]
});
psychoJS.experimentLogger.setLevel(core.Logger.ServerLevel.DEBUG);
var frameDur;
function updateInfo() {
expInfo['date'] = util.MonotonicClock.getDateStr(); // add a simple timestamp
expInfo['expName'] = expName;
expInfo['psychopyVersion'] = '2020.2.8';
expInfo['OS'] = window.navigator.platform;
// store frame rate of monitor if we can measure it successfully
expInfo['frameRate'] = psychoJS.window.getActualFrameRate();
if (typeof expInfo['frameRate'] !== 'undefined')
frameDur = 1.0 / Math.round(expInfo['frameRate']);
else
frameDur = 1.0 / 60.0; // couldn't get a reliable measure so guess
// add info from the URL:
util.addInfoFromUrl(expInfo);
return Scheduler.Event.NEXT;
}
var Pre_Virtual_Chin_RestClock;
var text;
var mouse;
var Instructions_CreditCard_Clock;
var instr_text;
var end_instr;
var CreditCardResizeClock;
var creditCard;
var modify_size;
var modify_size_text;
var force_end_space;
var Instructions_BlindSpotClock;
var instruction_test;
var end_instr_movingdot;
var movingDotTrialClock;
var resp_enteredBlindSpot;
var movingDot;
var fixateSquare;
var Post_Virtual_Chin_RestClock;
var mouse_2;
var text_2;
var InstructionsClock;
var mouse_3;
var text_3;
var Instructions_2Clock;
var mouse_4;
var text_4;
var Instructions_3Clock;
var mouse_5;
var text_5;
var image_6;
var Instructions_4Clock;
var mouse_6;
var text_6;
var image_7;
var Instructions_5Clock;
var mouse_7;
var text_7;
var Instructions_6Clock;
var mouse_8;
var text_8;
var Instructions_7Clock;
var mouse_9;
var text_9;
var Instructions_8Clock;
var mouse_10;
var text_10;
var trial2Clock;
var image_dot;
var image;
var trialClock;
var image_1;
var image_2;
var image_3;
var image_4;
var image_5;
var resp;
var Pre_ExperimentClock;
var mouse_11;
var text_11;
var DebreifingClock;
var mouse_13;
var text_13;
var globalClock;
var routineTimer;
function experimentInit() {
var percentWidth = 0.9; //the percent width of the screen that the text will fill up before wrapping around
var h = window.screen.height;
var w = window.screen.width;
var textWrapWidth = percentWidth*w/h;
var widthDimPix = w*0.4; //the fixation square and red dot will be set off center (right) by 40% of the screen width
// Initialize components for Routine "Pre_Virtual_Chin_Rest"
Pre_Virtual_Chin_RestClock = new util.Clock();
text = new visual.TextStim({
win: psychoJS.window,
name: 'text',
text: 'Prior to the experiment you will complete two short pre exercizes. \n(Click anywhere to continue)',
font: 'Arial',
units: undefined,
pos: [0, 0], height: 0.05, wrapWidth: undefined, ori: 0,
color: new util.Color('white'), opacity: 1,
depth: 0.0
});
mouse = new core.Mouse({
win: psychoJS.window,
});
mouse.mouseClock = new util.Clock();
// Initialize components for Routine "Instructions_CreditCard_"
Instructions_CreditCard_Clock = new util.Clock();
//instructions for the credit card task
instr_text = new visual.TextStim({
win: psychoJS.window,
name: 'instr_text',
text: "Please use any credit card, driver’s license, or card of the same size that you have available.\n Hold the card against the screen and adjust the rectangle to match the card’s size.\n\nTo increase the height of the rectangle, press the ‘up’ arrow key. To decrease the height, press ‘down’ arrow key.\nTo increase the width, press the ‘left’ key. To decrease the width, press the ‘right’ key.\n\n(If you don't have access to a real card, you can use a ruler to ensure the image width is 3.37inches or 85.6mm.)\n\n Make sure you put the card against your screen.\n\nPress the space bar to continue.",
font: 'Arial',
units: undefined,
pos: [0, 0], height: 0.04, wrapWidth: undefined, ori: 0,
color: new util.Color('white'), opacity: 1,
depth: 0.0
});
end_instr = new core.Keyboard({psychoJS: psychoJS, clock: new util.Clock(), waitForStart: true});
// Initialize components for Routine "CreditCardResize"
CreditCardResizeClock = new util.Clock();
creditCard = new visual.Rect ({
win: psychoJS.window, name: 'creditCard', units : 'pix',
width: [1.0, 1.0][0], height: [1.0, 1.0][1],
ori: 0, pos: [0, 0],
lineWidth: 1, lineColor: new util.Color([(- 1), (- 1), (- 1)]),
fillColor: new util.Color([(- 1), (- 1), (- 1)]),
opacity: 1, depth: 0, interpolate: true,
});
modify_size = new core.Keyboard({psychoJS: psychoJS, clock: new util.Clock(), waitForStart: true});
force_end_space = new core.Keyboard({psychoJS: psychoJS, clock: new util.Clock(), waitForStart: true});
//instructions displayed on the screen while doing the task
modify_size_text = new visual.TextStim({
win: psychoJS.window,
name: 'modify_size_text',
text: "To increase height press ‘up’ to decrease height press ‘down’.\nTo increase width press ‘left’ to decrease width press ‘right’.\nClick the space bar when you are satisfied that the size of the rectangle matches that of the card.\n",
font: 'Arial',
units: undefined,
pos: [0, 0.35], height: 0.04, wrapWidth: textWrapWidth, ori: 0,
color: new util.Color('white'), opacity: 1,
depth: 0.0
});
// Initialize components for Routine "Instructions_BlindSpot"
Instructions_BlindSpotClock = new util.Clock();
instruction_test = new visual.TextStim({
win: psychoJS.window,
name: 'instruction_test',
text: 'Instructions \n\n1. Put your finger on space bar on the keyboard.\n\n2. Close your right eye. (Tip: it might be easier to cover your right eye by hand!)\n\n3. Using your left eye, keep your focus on the black square that will appear on the right-hand side.\n\n4. A red ball will disappear as it moves away from the black square (be sure to keep looking at the black square while the red ball moves).\nPress the space bar as soon as the ball disappears from your eyesight. \n\nThis will repeat eight times. Keep your right eye closed and hit the space bar key as fast as you can when the ball disappears!\n\n To start the task, press the space bar.',
font: 'Arial',
units: undefined,
pos: [0, 0], height: 0.04, wrapWidth: undefined, ori: 0,
color: new util.Color('white'), opacity: 1,
depth: 0.0
});
end_instr_movingdot = new core.Keyboard({psychoJS: psychoJS, clock: new util.Clock(), waitForStart: true});
// Initialize components for Routine "movingDotTrial"
movingDotTrialClock = new util.Clock();
resp_enteredBlindSpot = new core.Keyboard({psychoJS: psychoJS, clock: new util.Clock(), waitForStart: true});
movingDot = new visual.Polygon ({
win: psychoJS.window, name: 'movingDot', units : 'pix',
edges: 10, size:[20, 20],
ori: 0, pos: [widthDimPix, 0],
lineWidth: 1, lineColor: new util.Color([1.0, (- 1.0), (- 1.0)]),
fillColor: new util.Color([1.0, (- 1.0), (- 1.0)]),
opacity: 1, depth: -1, interpolate: true,
});
fixateSquare = new visual.Rect ({
win: psychoJS.window, name: 'fixateSquare', units : 'pix',
width: [20, 20][0], height: [20, 20][1],
ori: 0, pos: [widthDimPix, 0],
lineWidth: 1, lineColor: new util.Color([(- 1), (- 1), (- 1)]),
fillColor: new util.Color([(- 1), (- 1), (- 1)]),
opacity: 1, depth: -2, interpolate: true,
});
// Initialize components for Routine "Post_Virtual_Chin_Rest"
Post_Virtual_Chin_RestClock = new util.Clock();
mouse_2 = new core.Mouse({
win: psychoJS.window,
});
mouse_2.mouseClock = new util.Clock();
text_2 = new visual.TextStim({
win: psychoJS.window,
name: 'text_2',
text: 'Thank you for completing the short exercises. Now on to the experiment. \n(Click anywhere to continue)',
font: 'Arial',
units: undefined,
pos: [0, 0], height: 0.05, wrapWidth: undefined, ori: 0,
color: new util.Color('white'), opacity: 1,
depth: -1.0
});
// Initialize components for Routine "Instructions"
InstructionsClock = new util.Clock();
mouse_3 = new core.Mouse({
win: psychoJS.window,
});
mouse_3.mouseClock = new util.Clock();
text_3 = new visual.TextStim({
win: psychoJS.window,
name: 'text_3',
text: 'Please wear the eyeglasses or corrective lenses that you feel are best for this viewing distance. \n\n(Click anywhere to continue). ',
font: 'Arial',
units: undefined,
pos: [0, 0], height: 0.05, wrapWidth: undefined, ori: 0,
color: new util.Color('white'), opacity: 1,
depth: -1.0
});
// Initialize components for Routine "Instructions_2"
Instructions_2Clock = new util.Clock();
mouse_4 = new core.Mouse({
win: psychoJS.window,
});
mouse_4.mouseClock = new util.Clock();
text_4 = new visual.TextStim({
win: psychoJS.window,
name: 'text_4',
text: 'For this experiment, we are investigating face perception. On each trial, you will first be shown a single face, and then asked to select that face from within a small set that appears afterwards. \n\n\n\n(Click anywhere to continue). \n\n',
font: 'Arial',
units: undefined,
pos: [0, 0], height: 0.05, wrapWidth: undefined, ori: 0,
color: new util.Color('white'), opacity: 1,
depth: -1.0
});
// Initialize components for Routine "Instructions_3"
Instructions_3Clock = new util.Clock();
mouse_5 = new core.Mouse({
win: psychoJS.window,
});
mouse_5.mouseClock = new util.Clock();
text_5 = new visual.TextStim({
win: psychoJS.window,
name: 'text_5',
text: 'Each trial will begin with a black dot in the middle of the screen. Look at the dot: this is the location where the target face will then be shown.\n\n\n\n(Click anywhere to continue). \n\n',
font: 'Arial',
units: undefined,
pos: [0, 0], height: 0.05, wrapWidth: undefined, ori: 0,
color: new util.Color('white'), opacity: 1,
depth: -1.0
});
image_6 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_6', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, (- 0.3)], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -2.0
});
// Initialize components for Routine "Instructions_4"
Instructions_4Clock = new util.Clock();
mouse_6 = new core.Mouse({
win: psychoJS.window,
});
mouse_6.mouseClock = new util.Clock();
text_6 = new visual.TextStim({
win: psychoJS.window,
name: 'text_6',
text: 'The target face will appear briefly, then automatically replaced with a small set of faces.\n\n(Click anywhere to continue). \n\n',
font: 'Arial',
units: undefined,
pos: [0, 0.25], height: 0.04, wrapWidth: undefined, ori: 0,
color: new util.Color('white'), opacity: 1,
depth: -1.0
});
image_7 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_7', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, (- 0.2)], size : [0.35, 0.34],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -2.0
});
// Initialize components for Routine "Instructions_5"
Instructions_5Clock = new util.Clock();
mouse_7 = new core.Mouse({
win: psychoJS.window,
});
mouse_7.mouseClock = new util.Clock();
text_7 = new visual.TextStim({
win: psychoJS.window,
name: 'text_7',
text: 'Once the small set of faces appears, select the face that matches the identity of the target face you just saw. To make your choice, simply click on the face. Typically, this process takes only one to two seconds, although sometimes it may take longer. The goal is to be accurate in your choice.\n\n\n\n(Click anywhere to continue). \n\n',
font: 'Arial',
units: undefined,
pos: [0, 0], height: 0.05, wrapWidth: undefined, ori: 0,
color: new util.Color('white'), opacity: 1,
depth: -1.0
});
// Initialize components for Routine "Instructions_6"
Instructions_6Clock = new util.Clock();
mouse_8 = new core.Mouse({
win: psychoJS.window,
});
mouse_8.mouseClock = new util.Clock();
text_8 = new visual.TextStim({
win: psychoJS.window,
name: 'text_8',
text: 'If for any reason you need a break; feel free to step away when the small set of faces appears before making your choice. To continue the experiment, simply make your choice. \n\n\n\n(Click anywhere to continue). \n\n',
font: 'Arial',
units: undefined,
pos: [0, 0], height: 0.05, wrapWidth: undefined, ori: 0,
color: new util.Color('white'), opacity: 1,
depth: -1.0
});
// Initialize components for Routine "Instructions_7"
Instructions_7Clock = new util.Clock();
mouse_9 = new core.Mouse({
win: psychoJS.window,
});
mouse_9.mouseClock = new util.Clock();
text_9 = new visual.TextStim({
win: psychoJS.window,
name: 'text_9',
text: 'If, however, you would like to exit the experiment before it ends, without completing the task, then close the window you are using. This will end the experiment and your data will not be used. \n\n\n\n(Click anywhere to continue).\n\n',
font: 'Arial',
units: undefined,
pos: [0, 0], height: 0.05, wrapWidth: undefined, ori: 0,
color: new util.Color('white'), opacity: 1,
depth: -1.0
});
// Initialize components for Routine "Instructions_8"
Instructions_8Clock = new util.Clock();
mouse_10 = new core.Mouse({
win: psychoJS.window,
});
mouse_10.mouseClock = new util.Clock();
text_10 = new visual.TextStim({
win: psychoJS.window,
name: 'text_10',
text: 'Before starting the actual experiment, you will first complete ten practice trials. \n\n\n\nTo begin, click anywhere on the screen. \n\n',
font: 'Arial',
units: undefined,
pos: [0, 0], height: 0.05, wrapWidth: undefined, ori: 0,
color: new util.Color('white'), opacity: 1,
depth: -1.0
});
// Initialize components for Routine "trial2"
trial2Clock = new util.Clock();
image_dot = new visual.ImageStim({
win : psychoJS.window,
name : 'image_dot', units : undefined,
image : 'images/fixation.png', mask : undefined,
ori : 0, pos : [0, 0], size : [0.02, 0.02],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : 0.0
});
image = new visual.ImageStim({
win : psychoJS.window,
name : 'image', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -1.0
});
// Initialize components for Routine "trial"
trialClock = new util.Clock();
image_1 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_1', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : 0.0
});
image_2 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_2', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -1.0
});
image_3 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_3', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -2.0
});
image_4 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_4', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -3.0
});
image_5 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_5', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -4.0
});
resp = new core.Mouse({
win: psychoJS.window,
});
resp.mouseClock = new util.Clock();
// Initialize components for Routine "trial2"
trial2Clock = new util.Clock();
image_dot = new visual.ImageStim({
win : psychoJS.window,
name : 'image_dot', units : undefined,
image : 'images/fixation.png', mask : undefined,
ori : 0, pos : [0, 0], size : [0.02, 0.02],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : 0.0
});
image = new visual.ImageStim({
win : psychoJS.window,
name : 'image', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -1.0
});
// Initialize components for Routine "trial"
trialClock = new util.Clock();
image_1 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_1', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : 0.0
});
image_2 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_2', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -1.0
});
image_3 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_3', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -2.0
});
image_4 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_4', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -3.0
});
image_5 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_5', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -4.0
});
resp = new core.Mouse({
win: psychoJS.window,
});
resp.mouseClock = new util.Clock();
// Initialize components for Routine "Pre_Experiment"
Pre_ExperimentClock = new util.Clock();
mouse_11 = new core.Mouse({
win: psychoJS.window,
});
mouse_11.mouseClock = new util.Clock();
text_11 = new visual.TextStim({
win: psychoJS.window,
name: 'text_11',
text: 'You have completed the practice trials. \n\n\n\nClick anywhere on the screen to begin the experiment.\n\n',
font: 'Arial',
units: undefined,
pos: [0, 0], height: 0.05, wrapWidth: undefined, ori: 0,
color: new util.Color('white'), opacity: 1,
depth: -1.0
});
// Initialize components for Routine "trial2"
trial2Clock = new util.Clock();
image_dot = new visual.ImageStim({
win : psychoJS.window,
name : 'image_dot', units : undefined,
image : 'images/fixation.png', mask : undefined,
ori : 0, pos : [0, 0], size : [0.02, 0.02],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : 0.0
});
image = new visual.ImageStim({
win : psychoJS.window,
name : 'image', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -1.0
});
// Initialize components for Routine "trial"
trialClock = new util.Clock();
image_1 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_1', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : 0.0
});
image_2 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_2', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -1.0
});
image_3 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_3', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -2.0
});
image_4 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_4', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -3.0
});
image_5 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_5', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -4.0
});
resp = new core.Mouse({
win: psychoJS.window,
});
resp.mouseClock = new util.Clock();
// Initialize components for Routine "trial2"
trial2Clock = new util.Clock();
image_dot = new visual.ImageStim({
win : psychoJS.window,
name : 'image_dot', units : undefined,
image : 'images/fixation.png', mask : undefined,
ori : 0, pos : [0, 0], size : [0.02, 0.02],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : 0.0
});
image = new visual.ImageStim({
win : psychoJS.window,
name : 'image', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -1.0
});
// Initialize components for Routine "trial"
trialClock = new util.Clock();
image_1 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_1', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : 0.0
});
image_2 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_2', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -1.0
});
image_3 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_3', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -2.0
});
image_4 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_4', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -3.0
});
image_5 = new visual.ImageStim({
win : psychoJS.window,
name : 'image_5', units : undefined,
image : undefined, mask : undefined,
ori : 0, pos : [0, 0], size : [0.25, 0.25],
color : new util.Color([1, 1, 1]), opacity : 1,
flipHoriz : false, flipVert : false,
texRes : 512, interpolate : true, depth : -4.0
});
resp = new core.Mouse({
win: psychoJS.window,
});
resp.mouseClock = new util.Clock();
// Initialize components for Routine "Debreifing"
DebreifingClock = new util.Clock();
mouse_13 = new core.Mouse({
win: psychoJS.window,
});
mouse_13.mouseClock = new util.Clock();
text_13 = new visual.TextStim({
win: psychoJS.window,
name: 'text_13',
text: 'Debriefing\n\nThank you for your participation!\n\nFacial processing and facial recognition are both necessary for our daily social interactions. With masks becoming a mandatory part of life, the question arises of how they affect the way we see faces. Facial processing can be separated into many different aspects, two being facial memory and facial perception. Recent studies have found that facial memory seems to be significantly affected by masks. This information, however, does not explain masks effect on perception. Facial perception speaks specifically to the initial processes to depict facial properties. These properties include such things as facial features (eyes, mouth, nose), and individualistic spots that vary from person to person. This experiment wanted to investigate perception and how masks may hinder that within a wide range of populations.\n\nUnlike face memory, we think masks may not hinder facial perception to the extent previously thought. During face perception, people attend mostly to the eye regions of the face. As masks only cover the nose and mouth, it is possible the apparent deficit in face processing may not be due to perception. We hope to answer some of the questions posed, and better understand how masks affect this one aspect of face processing, face perception.\n\nIf you require any further information regarding this research project or your participation in the study, you may contact Jamie Cochrane (cochrj1@mcmaster.ca). If you have any questions about your rights as a research participant or the conduct of this study, you may contact the McMaster Research Ethics Board (MREB) at 905-525-9140, ext. 23142, or email at (srebsec@mcmaster.ca).\n\n',
font: 'Arial',
units: undefined,
pos: [0, 0], height: 0.05, wrapWidth: undefined, ori: 0,
color: new util.Color('white'), opacity: 1,
depth: -1.0
});
// Create some handy timers
globalClock = new util.Clock(); // to track the time since experiment started
routineTimer = new util.CountdownTimer(); // to track time remaining of each (non-slip) routine
return Scheduler.Event.NEXT;
}
var t;
var frameN;
var _end_instr_allKeys;
var gotValidClick;
function random_character() {
var chars = "ABC";
return chars.substr( Math.floor(Math.random() * 3), 1);
}
var condition = random_character();
var Pre_Virtual_Chin_RestComponents;
function Pre_Virtual_Chin_RestRoutineBegin(snapshot) {
return function () {
//------Prepare to start Routine 'Pre_Virtual_Chin_Rest'-------
t = 0;
Pre_Virtual_Chin_RestClock.reset(); // clock
frameN = -1;
// update component parameters for each repeat
// setup some python lists for storing info about the mouse
gotValidClick = false; // until a click is received
// keep track of which components have finished
Pre_Virtual_Chin_RestComponents = [];
Pre_Virtual_Chin_RestComponents.push(text);
Pre_Virtual_Chin_RestComponents.push(mouse);
for (const thisComponent of Pre_Virtual_Chin_RestComponents)
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;
}
};
}
var prevButtonState;
var _mouseButtons;
var continueRoutine;
function Pre_Virtual_Chin_RestRoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'Pre_Virtual_Chin_Rest'-------
let continueRoutine = true; // until we're told otherwise
// get current time
t = Pre_Virtual_Chin_RestClock.getTime();
frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
// update/draw components on each frame
// *text* updates
if (t >= 0.0 && text.status === PsychoJS.Status.NOT_STARTED) {
// keep track of start time/frame for later
text.tStart = t; // (not accounting for frame time here)
text.frameNStart = frameN; // exact frame index
text.setAutoDraw(true);
}
// *mouse* updates
if (t >= 0.0 && mouse.status === PsychoJS.Status.NOT_STARTED) {
// keep track of start time/frame for later
mouse.tStart = t; // (not accounting for frame time here)
mouse.frameNStart = frameN; // exact frame index
mouse.status = PsychoJS.Status.STARTED;
mouse.mouseClock.reset();
prevButtonState = mouse.getPressed(); // if button is down already this ISN'T a new click
}
if (mouse.status === PsychoJS.Status.STARTED) { // only update if started and not finished!
_mouseButtons = mouse.getPressed();
if (!_mouseButtons.every( (e,i,) => (e == prevButtonState[i]) )) { // button state changed?
prevButtonState = _mouseButtons;
if (_mouseButtons.reduce( (e, acc) => (e+acc) ) > 0) { // state changed to a new click
// abort routine on response
continueRoutine = false;
}
}
}
// check for quit (typically the Esc key)
if (psychoJS.experiment.experimentEnded || psychoJS.eventManager.getKeys({keyList:['escape']}).length > 0) {
return quitPsychoJS('The [Escape] key was pressed. Goodbye!', false);
}
// check if the Routine should terminate
if (!continueRoutine) { // a component has requested a forced-end of Routine