Reference for the Mosaic class Effects::OpacityFader



Implement your own Dialog transition animation.

The class Effects::OpacityFader provides functionality for the fade-in and fade-out transitions affecting the opacity of a given GUI component. This fader is thus ideal wherever one GUI component should smoothly appear or disappear in context of another component without changing its actual position.

The parameters for the transition (the start and the end values for the opacity, the duration of the transition, its timing, etc.) are configured in the embedded object Effect. If the property UseCurrentState is 'true', the opacity to start the animation is automatically taken over from the affected GUI component as it is just in the moment the fader starts the transition.

Whether the fader is considered as performing a fade-in or fade-out transition is determined by value of the property Visible. Set this property to the value 'true' if you want the component to appear or remain visible after the transition is done. Set this property to the value 'false' if your intention is to hide or keep invisible the component.

With the property Buffered you can configure, whether the fader should additionally enable the buffering mode for the affected GUI component while it drives the transition.

The fader automatically takes care of adding the GUI component to the intended owner, when the component should appear and it is not yet a member within the owner. Moreover, when fading-in the component, the fader automatically focuses it and restacks it to appear above all other sibling views existing already within the owner component. This behavior can be configured by modifying the properties AssignFocus and RestackTopmost.

The fader automatically removes the GUI component from its owner, when the component disappears (after fade-out). This behavior can be changed by modifying the property RemoveIfHidden.

Applying the fade-out transition on a GUI component, which is already invisible has no effect. Similarly, the fade-in transition has no effect if the GUI component is already visible and has the opacity equal to the specified in Effect object. In both cases the affected component retains its actual state and the fader finishes its work immediately without driving the Effect object and waiting for its finish.

In practice, you create an instance of the fader class, configure its properties (in particular the property Visible) and the Effect object according to the desired kind of transition and pass both, the fader instance and the affected GUI component as parameters in the invocation of the method Core::Group.FadeGroup().

property bool Buffered = false;

The property 'Buffered' determines, whether the fader should enable the buffered mode for the affected GUI component Group while it drives the transition. Enabling this mode can optimize (speed up) the screen updates. On the other hand buffering requires additional memory to store inside the actual image of the affected GUI component. It is thus intended for target systems providing sufficient RAM resources.

object Effects::Int32Effect Effect;

The embedded object 'Effect' determines the parameters to use for the opacity animation. In particular, its properties 'Value1' and 'Value2' are intended to specify the desired opacity at the beginning and at the end of the transition. How long the transition should take, has to be specified in the property 'CycleDuration'. During the transition, the 'Effect' object interpolates between the both values and adjusts accordingly the opacity of the affected GUI component. For more details, how to configure an effect, see the description of the class Effects::Int32Effect.

Please note, if the property UseCurrentState is 'true', the fader will automatically adapt the property 'Value1' of the 'Effect' object to the opacity value of the affected GUI component as it is just in the moment when the fader starts the transition. Moreover, whether the fader operation is considered as performing the fade-in or fade-out operation, depends exclusively on the value you specify in the property Visible.

Usually, you configure this 'Effect' object shortly before you pass the fader in parameter to the Core::Group.FadeGroup() method.