Present one image on the top of another

Description of the problem:

MacOS
PsychoPy version: 2021.2.3
Standard Standalone? (yes)
What are you trying to achieve?:

  • I have two images working as background (image 1 and image 2). And one object (image 3) will be moving from the bottom to the top, as if it comes out of the box. It works perfect locally because I can arrange the three images very easily. However, when it goes to pavlovia, the bottom image is presented behind the object (image 4). I am wondering if there is an easy way to present the bottom image on the top of the object. Thank you so much!

image 1

image 2

image 3
14

image 4

The key to doing this online is to make sure that the foreground is being updated every time the background changes. I either alternate the opacity between.98 and .99 or move it up and down by a pixel.

Hi @wakecarter, thanks so much for your quick reply! Could you please give me more instruction about how to alternate the opacity? Do you mean that I need to update the opacity of the object (image3) every frame? Thank you so much!

It’s image2 you need to keep in front.

The following might work

image2.setOpacity(1-.01*frameN%2)

You might be able to put 1-.01*frameN%2 in the image component instead of in code.

If opacity doesn’t work, try doing the same to the x coordinate.

Sorry for the late reply! THank you so much for your help, I really appreciate it.