-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplayFlashAnimation.m
More file actions
84 lines (68 loc) · 3.27 KB
/
playFlashAnimation.m
File metadata and controls
84 lines (68 loc) · 3.27 KB
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
%move the character so it looks like they slide across screen
Screen('FillRect', EXPWIN, GREY);
anim_t_length=30;
%
% if(Constants.TrainingTrials)
% if(CorrectLocation(trial)==Constants.RIGHT)
% creat path
% xd=mean(FixationSquare([1 3]))-mean(RightChoiceSquare([1 3]));
% yd=mean(FixationSquare([2 4]))-mean(RightChoiceSquare([2 4]));
% ANIM_blockTex=blockTex_RIGHT;
% elseif(CorrectLocation(trial)==Constants.LEFT)
% elseif(Constants.LRvisible ~= 2); %2=right only visible
% xd=mean(FixationSquare([1 3]))-mean(LeftChoiceSquare([1 3]));
% yd=mean(FixationSquare([2 4]))-mean(LeftChoiceSquare([2 4]));
% ANIM_blockTex=blockTex_LEFT;
% end
% else
% LOOKING AT LEFT SIDE AOI
% if(EyeInsideLR(end,1)==1 & EyeInsideLR(end,2)==0)
% xd=mean(FixationSquare([1 3]))-mean(LeftChoiceSquare([1 3]));
% yd=mean(FixationSquare([2 4]))-mean(LeftChoiceSquare([2 4]));
% ANIM_blockTex=blockTex_LEFT;
% LOOKING AT RIGHT SIDE AOI
% elseif(EyeInsideLR(end,1)==0 & EyeInsideLR(end,2)==1)
% xd=mean(FixationSquare([1 3]))-mean(RightChoiceSquare([1 3]));
% yd=mean(FixationSquare([2 4]))-mean(RightChoiceSquare([2 4]));
% ANIM_blockTex=blockTex_RIGHT;
% end
% end
% lets animate in 1 sec
% xd=xd/anim_t_length;
% yd=yd/anim_t_length;
for fr=1:anim_t_length
Screen('FillRect',EXPWIN,GREY);
%NewFixationSquare=[FixationSquare(1)-xd*fr FixationSquare(2)-yd*fr FixationSquare(3)-xd*fr FixationSquare(4)-yd*fr];
%Screen('DrawTexture', EXPWIN, ANIM_blockTex, bRect, NewFixationSquare);
if( ~mod(fr,10)==0 ) %flash off
if(CorrectLocation(trial)==Constants.LEFT)
Screen('FillRect', EXPWIN, choiceColors(:,2), RightChoiceSquare);
DrawFormattedText(EXPWIN,'?','Center','Center',WHITE,[],[],[],[],[],RightChoiceSquare);
elseif(CorrectLocation(trial)==Constants.RIGHT)
Screen('FillRect', EXPWIN, choiceColors(:,1), LeftChoiceSquare);
DrawFormattedText(EXPWIN,'?','Center','Center',WHITE,[],[],[],[],[],LeftChoiceSquare);
end
else %flashing on
Screen('FillRect', EXPWIN, choiceColors, ...
[LeftChoiceSquare; RightChoiceSquare]');
Screen('TextSize',EXPWIN, 60);
DrawFormattedText(EXPWIN,'?','Center','Center',WHITE,[],[],[],[],[],LeftChoiceSquare);
DrawFormattedText(EXPWIN,'?','Center','Center',WHITE,[],[],[],[],[],RightChoiceSquare);
end
if(Constants.UseEyeTracker)
drawGazeCursor;
end
Screen(EXPWIN,'Flip');
WaitSecs(1/60);
end
Screen('FillRect', EXPWIN, choiceColors, ...
[LeftChoiceSquare; RightChoiceSquare]');
Screen('TextSize',EXPWIN, 60);
if(Constants.LRvisible == 2); %1=left only visible
DrawFormattedText(EXPWIN,'?','Center','Center',WHITE,[],[],[],[],[],RightChoiceSquare);
elseif(Constants.LRvisible == 1); %2=right only visible
DrawFormattedText(EXPWIN,'?','Center','Center',WHITE,[],[],[],[],[],LeftChoiceSquare);
else
DrawFormattedText(EXPWIN,'?','Center','Center',WHITE,[],[],[],[],[],LeftChoiceSquare);
DrawFormattedText(EXPWIN,'?','Center','Center',WHITE,[],[],[],[],[],RightChoiceSquare);
end