function data = example_5();
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% COGENT: CONFIGURATION
% display parameters
screenMode = 0;                 % 0 for small window, 1 for full screen, 2 for second screen if attached
screenRes = 2;                  % 800 x 600 resolution
white = [1 1 1];                % foreground colour (optional)
black = [0 0 0];                % background colour (optional)
fontName = 'Helvetica';         % font parameters (optional)
fontSize = 50;
number_of_buffers = 5;          % how many offscreen buffers to create

% call config_... to set up cogent environment, before starting cogent
config_display(screenMode, screenRes, black ,white, fontName, fontSize, number_of_buffers);   % open graphics window
config_keyboard;                % this enables collection of keyboard responses
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc;




disp('Line motion illusion');
input('Press ENTER to go to example 5');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% EXAMPLE FIVE: Presenting an IMAGE in various sizes, locations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
start_cogent
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cgtext('Press any key to Start',0,0);
cgflip;
waitkeydown(inf);
cgflip(0,0,0);cgflip(0,0,0);

for i = 1 : 5
    dotX = (rand .* 300)-150;
    dotY = (rand .* 300)-150;

    endLineX = (rand .* 400)-200;
    endLineY = (rand .* 400)-200;

    cgpenwid(5);
    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);

    waitkeydown(inf);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
stop_cogent
clear DATA;
clc;