-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplayFixAnimation.m
73 lines (60 loc) · 2.9 KB
/
playFixAnimation.m
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
%move the character so it looks like they slide across screen
Screen('FillRect', EXPWIN, GREY);
anim_t_length=60;
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
NewFixationSquare=[FixationSquare(1)-xd*fr FixationSquare(2)-yd*fr FixationSquare(3)-xd*fr FixationSquare(4)-yd*fr];
Screen('DrawTexture', EXPWIN, ANIM_blockTex, bRect, NewFixationSquare);
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
drawGazeCursor;
Screen(EXPWIN,'Flip');
WaitSecs(1/anim_t_length);
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