Image size change with mouse movement

Woohooo, thanks! That was a very helpful thought. This is how I solved it:

#Begin Routine:

TestMouse.setPos((0, 0))

TestMousePosition = TestMouse.getPos()[1]

ImageSizeX = formatheight[0]
ImageSizeY = formatheight[1]

ImageRatio = ImageSizeX / ImageSizeY

#Each Frame:

TestMousePosition = TestMouse.getRel()[1]

if ImageRatio < 1:
    ImageSizeY += TestMousePosition
    ImageSizeX += TestMousePosition * 0.8 

elif ImageRatio > 1:
    ImageSizeX += TestMousePosition
    ImageSizeY += TestMousePosition * 0.8

if (ImageSizeY >= 0) and (ImageSizeX >= 0):
    TestImage.size = (ImageSizeX, ImageSizeY)
else:
    TestImage.size = (0, 0)

With:

  • size = $ formatheight, set every repeat in the image-settings
  • and formatheight as a parameter in the xlxs-file for the conditions, defining the format of the stimuli in height-units (with (0.4, 0.5) for landscape and (0.5, 0.4) for portrait → if the ratio of short and long side is different, you need to adjust the factor of the size change, in my case 0.8)

Thanks a lot for your help, wakecarter, I was really stuck there.

Laura