Reference for the Mosaic class Effects::Effect
SEE ALSO
The class Effects::Effect provides the base functionality for all kinds of animation effects. Effects allow the designer to enrich the GUI application with additional fancy and eye candy animations. For example, the effect Effects::ColorEffect performs the color fade animation. Effects::RectEffect in contrast can animate the position and the size of a GUI component, etc. Animation effects are determined by their duration and by the timing function.
The duration is primarily controlled by the value of the property CycleDuration. This is the time the effect will take for a single animation run. Whether and how often the animation is repeated is stored in the property NoOfCycles. In this case the property InterCycleDelay can determine an optional interval to wait between two consecutive animation runs. Finally the property InitialDelay determines the interval to wait at the very beginning of the effect still before the first animation run began.
The timing function determines the curve to run the animation. The class implements an extensive set of various timing functions. In its simplest case the animation can follow a straight line, or it can start slow and get faster afterwards. More complex timings perform realistic spring elastic and bounce animations. Besides it the user can configure his/her own animation curve. In such case the timing function is based on a cubic Bezier curve. It gives the designer a lot of possibilities to specify very fancy timing functions. The timing is controlled by the property Timing. In the case the designer wants to specify a new curve, the properties TimingCustom1 and TimingCustom2 are available. With the property Noise an additional random noise can be added to the effect.
During the runtime of the animation, the effect will send signals to the slot method stored in the property OnAnimate. When the effect is finished a signal is send to the slot method stored in the OnFinished property.
Whether the effect is running or not is controlled by its property Enabled. It can be used to start and stop the effect. The effect can also be controlled by sending signals to its StartEffect and StopEffect slot methods. With the property Reversed the playback direction can be determined. This allows to simply rewind running effects or to configure an effect to be played in the reverse direction. The slot method ReverseEffect can also be used to switch the playback direction.
property float Amplitude = 0.5;
The property 'Amplitude' determines the magnitude of the retraction when Timing is configured with Effects::Timing.Back_In, Effects::Timing.Back_Out or Effects::Timing.Back_InOut.
The valid values for this property lie in the range 0.0 .. 10.0.
property int32 Bounces = 3;
The property 'Bounces' determines how often the animation should bounce on its start or/and finish position when Timing is configured with Effects::Timing.Bounce_In, Effects::Timing.Bounce_Out or Effects::Timing.Bounce_InOut.
The valid values for this property lie in the range 1 .. 10.
property int32 CycleDuration = 1000;
The property 'CycleDuration' stores the period in milliseconds of a single animation run.
property float Elasticity = 0.5;
The property 'Elasticity' determines the amplitude of a bounce in relation to the just preceding bounce when Timing is configured with Effects::Timing.Bounce_In, Effects::Timing.Bounce_Out or Effects::Timing.Bounce_InOut.
The valid values for this property lie in the range 0.0 .. 1.0 whereby the value 1.0 means that the bounce is very elastic.
property bool Enabled = false;
The property 'Enabled' determines whether the effect is currently running or not. Changing the value of this property from 'false' to 'true' will re-start the effect. In such case the effect will start from the beginning.
The lifetime of the effect can also be controlled by sending signals to the slot methods StartEffect and StopEffect. Moreover with the property Reversed and the slot method ReverseEffect the playback direction can be controlled.
property float Exponent = 3.0;
The property 'Exponent' determines the exponent parameter if Timing is configured with Effects::Timing.Power_In, Effects::Timing.Power_Out, Effects::Timing.Power_InOut, Effects::Timing.Exp_In, Effects::Timing.Exp_Out, Effects::Timing.Exp_InOut.
The valid values for this property lie in the range 1.0 .. 100.0.
property int32 InitialDelay = 0;
The property 'InitialDelay' stores the interval in milliseconds the effect should wait before the first animation run can begin. If InitialDelay is zero the effect will start the animation immediately.
property int32 InterCycleDelay = 0;
The property 'InterCycleDelay' stores the interval in milliseconds the effect should wait between two consecutive animation runs. This value has no effect if the animation is not repeated (NoOfCycles == 1) If InterCycleDelay is zero the effect will not wait between the animation runs.
property int32 NoOfCycles = 0;
The property 'NoOfCycles' determines how often the effect should repeat the animation. If this value is zero, the effect will run endless.
property float Noise = 0.0;
The property 'Noise' stores the magnitude of an additional random noise to apply on the resulting animation. Valid values for this property lie in range 0.0 .. 1.0.
property slot OnAnimate = null;
The property 'OnAnimate' can refer to a slot method, which should be invoked when the effect triggers the next animation frame. It's up to you to provide the slot method and to fill it with the desired behavior. From the method you can query the current progress of the animation. For this purpose derived classes provide a variable Value.
Usually, it is not necessary to implement any slot methods in order to perform the animation. All derived effect classes do provide an Outlet property, which can refer to the property which should be animated.
property slot OnFinished = null;
The property 'OnFinished' can refer to a slot method, which should be invoked when the effect is done. It's up to you to provide the slot method and to fill it with the desired behavior. It makes possible to chain effects together, so the finish of one effect can trigger another effect. To do this simply assign the StartEffect slot method of the one effect to the OnFinished property of the other effect.
property int32 Oscillations = 3;
The property 'Oscillations' determines how often the animation should oscillate back and forth around its start or/and finish position when Timing is configured with Effects::Timing.Elastic_In, Effects::Timing.Elastic_Out or Effects::Timing.Elastic_InOut.
The valid values for this property lie in the range 1 .. 10.
slot ReverseEffect;
The slot method 'ReverseEffect' advises the running effect to reverse its current playback direction. If the signal is sent while the effect is not running (property Enabled == false), nothing occurs.
property bool Reversed = false;
The property 'Reversed' controls the playback direction of the effect. If this property is 'false' the effect is played forward. If this property is 'true' the effect is played backward. You can change this property either while the effect is running or before the effect has been started:
Please note, when the effect ends (regardless of its playback direction) a signal is sent to the slot method specified in the property OnFinished.
slot StartEffect;
The slot method 'StartEffect' re-starts the effect if a signal is sent to this slot method. The effect will start from the beginning.
slot StopEffect;
The slot method 'StopEffect' stops the running effect if a signal is sent to this slot method. This causes the animation to pause at its current position.
property bool Symmetric = false;
The property 'Symmetric' determines with which value should terminate an animation run. Usually, the animation starts with the value specified in the property Value1 and ends with the value from the property Value2. If Symmetric == 'true', the animation starts and ends with the same value Value1. Value2 will be reached in the middle of the animation. Thus a single animation run seems as if it had been mirrored at its half-time.
property Effects::Timing Timing = Effects::Timing.Linear;
The property 'Timing' determines the curve to interpolate the animated values during the animation:
property float TimingCustom1 = 0.0;
The property 'TimingCustom1' controls the animation speed at the beginning of a user-defined timing function. The timing functions are based on cubic Bezier curves. Coming from a curve with a constant slope (a straight line), this property determines whether the curve should turn left (positive value) or turns right (negative value) at its beginning.
To activate the user-defined timing function, the property Timing should be initialized with the value Effects::Timing.Custom.
property float TimingCustom2 = 0.0;
The property 'TimingCustom2' controls the animation speed at the end of a user-defined timing function. The timing functions are based on cubic Bezier curves. Coming from a curve with a constant slope (a straight line), this property determines whether the curve should turn right (positive value) or turns left (negative value) at its end.
To activate the user-defined timing function, the property Timing should be initialized with the value Effects::Timing.Custom.