Hero image

Fading Image Texture

What the code does

This demo loads a picture of rabbits included in the PTB distribution, conversts it to a texture and dynamically fades the texture in and out of visibility with a temporal sine wave function. It does this by changing the "alpha" value of the texture (this is called alpha blending, or compositing). The alpha value ranges between 0-1, 0 being completely invisible and 1 being completely visible. For a value of 0.5 you can see half of the image and half of the background colour (the alpha value of the texture oscillates around this value during the demo).

Visualisation

The code

Instagram image Instagram image Instagram image Instagram image Instagram image Instagram image