screenMode = 0;
screenRes = 2;
white = [1 1 1];
black = [0 0 0];
fontName = 'Helvetica';
fontSize = 20;
number_of_buffers = 5;
rand('seed',sum(100*clock));
config_display(screenMode, screenRes, black ,white, fontName, fontSize, number_of_buffers);
config_keyboard;
clc;
disp('Line motion illusion');
input('Press ENTER to go to example 5');
start_cogent
cgtext('Press any key to Start',0,0);
cgflip;
waitkeydown(inf);
cgflip(0,0,0);cgflip(0,0,0);
wait(500);
for i = 1 : 5
cgpenwid(5);
dotX = (rand .* 300)-150;
dotY = (rand .* 300)-150;
endLineX = (rand .* 500)-250;
endLineY = (rand .* 500)-250;
cgellipse(dotX,dotY,10,10,[1 1 1], 'f');
cgflip(0,0,0);
wait(150);
cgflip(0,0,0);
cgdraw(dotX,dotY, endLineX,endLineY,[1 1 1]);
cgflip(0,0,0);
wait(100);
cgflip(0,0,0);
wait(1000);
cgtext('Press any key to continue',0,0);
cgflip;
waitkeydown(inf);
cgflip(0,0,0);cgflip(0,0,0);
end
stop_cogent
clc;
disp('Line motion illusion - multiple elements');
input('Press ENTER to go to example 5');
start_cogent
cgtext('Press any key to Start',0,0);
cgflip;
waitkeydown(inf);
cgflip(0,0,0);cgflip(0,0,0);
n = 2;
for i = 1 : 5
cgpenwid(5);
dotX = (rand(n,1) .* 300)-150;
dotY = (rand(n,1) .* 300)-150;
endLineX = (rand(n,1) .* 500)-250;
endLineY = (rand(n,1) .* 500)-250;
circleWidth = ones(n,1) * 10;
circleHeight = ones(n,1) * 10;
circleCol = ones(n,3);
lineCol = ones(n,3);
cgellipse(dotX,dotY,circleWidth,circleHeight,circleCol,'f');
cgflip(0,0,0);
wait(150);
cgflip(0,0,0);
cgdraw(dotX,dotY,endLineX,endLineY,lineCol);
cgflip(0,0,0);
wait(100);
cgflip(0,0,0);
wait(1000);
cgtext('Press any key to continue',0,0);
cgflip;
waitkeydown(inf);
cgflip(0,0,0);cgflip(0,0,0);
end
stop_cogent
clear DATA;
clc;