close all;
clear;
sca
PsychDefaultSetup(2);
screens = Screen('Screens');
screenNumber = max(screens);
black = BlackIndex(screenNumber);
white = WhiteIndex(screenNumber);
grey = white / 2;
[window, windowRect] = PsychImaging('OpenWindow', screenNumber, black);
ifi = Screen('GetFlipInterval', window);
Screen('BlendFunction', window, 'GL_SRC_ALPHA', 'GL_ONE_MINUS_SRC_ALPHA');
[screenXpixels, screenYpixels] = Screen('WindowSize', window);
Screen('TextSize', window, 90);
[xCenter, yCenter] = RectCenter(windowRect);
amplitude = screenXpixels * 0.2;
frequency = 0.2;
angFreq = 2 * pi * frequency;
time = 0;
startPhaseOne = 0;
startPhaseTwo = pi;
vbl = Screen('Flip', window);
waitframes = 1;
topPriorityLevel = MaxPriority(window);
Priority(topPriorityLevel);
while ~KbCheck
xposOne = amplitude * sin(angFreq * time + startPhaseOne);
xposTwo = amplitude * sin(angFreq * time + startPhaseTwo);
squareXposOne = xCenter + xposOne;
squareXposTwo = xCenter + xposTwo;
DrawFormattedText(window, 'Hello World', squareXposOne,...
screenYpixels * 0.25, [1 0 0]);
DrawFormattedText(window, 'Hello World', squareXposTwo,...
screenYpixels * 0.75, [1 0 1]);
vbl = Screen('Flip', window, vbl + (waitframes - 0.5) * ifi);
time = time + ifi;
end
sca;