Image fading and other algorithms

Hi everyone,

I am looking for an algorithm (or xojo implementation even better) or a fading in/out of an image.

I was, also, wondering if there is a kind of guide for the transition animations. For example, win 8 start up screen (the one with the buttons) has a nice effect. How is this called?

Does anyone have more information that can guide me?

Thanks

John

The easy way to fade in/out is to adjust the picture’s Mask. FillRect with rgb values from 0 (opaque) to 255 (transparent).

Hi Tim,

does it have to be with a specific color and then play with the transparency?

I, also, see your approach but this works only if you build the picture (design) yourself in xojo.

How about if you use a png file? I think to take the mask of it and apply what you say but it may not work as it will make opaque the pixels that are initially transparent, right?

If you are drawing the image to a canvas, another option is to simply set the g.Transparency property to the required value prior to drawing the image.

For example:

Sub Paint(g As Graphics, areas() As REALbasic.Rect)
  g.Transparency = 80
  g.DrawPicture MyPicture, 0, 0
End Sub

https://documentation.xojo.com/index.php/Graphics.Transparency

That’s the property I was searching for, but I was looking at the Picture object. Thanks for posting that Alwyn!

I had totally forgotten this property for the canvas. I had in mind only the one for the picture as Tim says.

Thank you both