psychopy.org | Reference | Downloads | Github

Creating a stimulus that zooms until response key press

I am interested in using PsychoPy for my experiment. I have been looking at a number of different software options, and there is one main function that I need to achieve in my experimental task.

Specifically, I would like my task to present stimuli that get larger (zoom in) until the participant makes a response key press. Following the key press, I would like the stimulus to zoom out until gone. If the participant does not make a key press, I would like the stimulus to keep getting larger until it fills in the whole screen. I am looking for software that would allow me to program this feature of the task, and am wondering if anyone knows whether this would be achievable using the coding feature in PsychoPy?

I have looked through the forum and on Python forums and all I can seem to find is functions that make it possible for a user to manually zoom in and out of an image. However, I would like this zooming to be automatic.

Any directions on whether this can be done, tutorials on this, suggested functions or useful code would be greatly appreciated. I will be using PsychoPy version 3 on Mac OS HighSierra to program the task.

Thank you in advance.

@sawilliams this is easily done using Builder. You can set a shape to increase/shrink in sizw according to the time (t).

  1. Set your shape units to pixels
  2. Set you shape size to (t * 500, t * 500) or by whatever speed you would like to increase - i chose 500px/sec
  3. Set size to update on every frame

In a code component at the following to the relevant tabs:

# Begin routine
stopSize = ''

# Every Frame 
keys = event.getKeys()
if polygon.size[0] >= win.size[0] or len(keys) and stopSize == '':
    stopSize = t*500  # If you change the rate of change in the shape, change this to match

if stopSize != '':
    polygon.setSize(stopSize)
    stopSize = stopSize-10 # 10 is the rate the object shrinks in pixels per frame
    if polygon.size[0] <= 0:
        continueRoutine=False