I am trying to display present_true_image for 2.5 seconds, but decrease its transparency by .05 every .5 seconds throughout the trial. However, I am having trouble implementing this. Any help would be amazing, thanks!
# *iti* updates
if iti.status == NOT_STARTED and tThisFlip >= 0-frameTolerance:
# keep track of start time/frame for later
iti.frameNStart = frameN # exact frame index
iti.tStart = t # local t and not account for scr refresh
iti.tStartRefresh = tThisFlipGlobal # on global time
win.timeOnFlip(iti, 'tStartRefresh') # time at next scr refresh
iti.setAutoDraw(True)
if iti.status == STARTED:
# is it time to stop? (based on global clock, using actual start)
if tThisFlipGlobal > iti.tStartRefresh + iti_times-frameTolerance:
# keep track of stop time/frame for later
iti.tStop = t # not accounting for scr refresh
iti.frameNStop = frameN # exact frame index
win.timeOnFlip(iti, 'tStopRefresh') # time at next scr refresh
iti.setAutoDraw(False)
# *present_true_image* updates
if present_true_image.status == NOT_STARTED and iti.status==FINISHED:
# keep track of start time/frame for later
present_true_image.frameNStart = frameN # exact frame index
present_true_image.tStart = t # local t and not account for scr refresh
present_true_image.tStartRefresh = tThisFlipGlobal # on global time
win.timeOnFlip(present_true_image, 'tStartRefresh') # time at next scr refresh
present_true_image.setAutoDraw(True)
if present_true_image.status == STARTED:
# is it time to stop? (based on global clock, using actual start)
if tThisFlipGlobal > present_true_image.tStartRefresh + 2.5-frameTolerance:
# keep track of stop time/frame for later
present_true_image.tStop = t # not accounting for scr refresh
present_true_image.frameNStop = frameN # exact frame index
win.timeOnFlip(present_true_image, 'tStopRefresh') # time at next scr refresh
present_true_image.setAutoDraw(False)
# *present_grey_square_frame* updates
if present_grey_square_frame.status == NOT_STARTED and iti.status==FINISHED:
# keep track of start time/frame for later
present_grey_square_frame.frameNStart = frameN # exact frame index
present_grey_square_frame.tStart = t # local t and not account for scr refresh
present_grey_square_frame.tStartRefresh = tThisFlipGlobal # on global time
win.timeOnFlip(present_grey_square_frame, 'tStartRefresh') # time at next scr refresh
present_grey_square_frame.setAutoDraw(True)
if present_grey_square_frame.status == STARTED:
# is it time to stop? (based on global clock, using actual start)
if tThisFlipGlobal > present_grey_square_frame.tStartRefresh + 2.5-frameTolerance:
# keep track of stop time/frame for later
present_grey_square_frame.tStop = t # not accounting for scr refresh
present_grey_square_frame.frameNStop = frameN # exact frame index
win.timeOnFlip(present_grey_square_frame, 'tStopRefresh') # time at next scr refresh
present_grey_square_frame.setAutoDraw(False)
# *space_advance* updates
waitOnFlip = False
if space_advance.status == NOT_STARTED and iti.status==FINISHED:
# keep track of start time/frame for later
space_advance.frameNStart = frameN # exact frame index
space_advance.tStart = t # local t and not account for scr refresh
space_advance.tStartRefresh = tThisFlipGlobal # on global time
win.timeOnFlip(space_advance, 'tStartRefresh') # time at next scr refresh
space_advance.status = STARTED
# keyboard checking is just starting
waitOnFlip = True
win.callOnFlip(space_advance.clock.reset) # t=0 on next screen flip
win.callOnFlip(space_advance.clearEvents, eventType='keyboard') # clear events on next screen flip
if space_advance.status == STARTED:
# is it time to stop? (based on global clock, using actual start)
if tThisFlipGlobal > space_advance.tStartRefresh + 2.5-frameTolerance:
# keep track of stop time/frame for later
space_advance.tStop = t # not accounting for scr refresh
space_advance.frameNStop = frameN # exact frame index
win.timeOnFlip(space_advance, 'tStopRefresh') # time at next scr refresh
space_advance.status = FINISHED
if space_advance.status == STARTED and not waitOnFlip:
theseKeys = space_advance.getKeys(keyList=['space'], waitRelease=False)
_space_advance_allKeys.extend(theseKeys)
if len(_space_advance_allKeys):
space_advance.keys = _space_advance_allKeys[-1].name # just the last key pressed
space_advance.rt = _space_advance_allKeys[-1].rt
# a response ends the routine
continueRoutine = False