Animates a repeating cycle between a high and low value using a given waveform.
The cycling of the animation continues even when the
Trigger.Progress reaches 1. When a trigger is deactivated the cycling will play backwards, possibly beyond reaching Progress=1, until it finds a suitable rest state. This ensure that
Cycle does not produce any jarring switches when the triggers are activated and deactivated.
The below example creates a simple pulsing effect on the panel while it is pressed.
<Panel Color="Blue" ux:Name="panel1" Width="100" Height="100"> <WhilePressed> <Cycle Target="panel1.Width" Low="80" High="120" Frequency="0.5"/> </WhilePressed> </Panel>
By adjusting the
Waveform you can creates animations that wrap-around instead of bouncing back and forth.
<Cycle Target="panel.X" Low="-100" High="100" Waveform="Triangle"/>
The "wrap-around" here is simply the nature of the triangular waveform -- the default waveform is sinusoidal.
The properties are defined to be a simple interface, but it may be easier to understand see how they all relate in an expression. Given a current time offset the value of the
Target is defined roughly as:
Target.Value = Lerp( Low, High, Easing( Waveform(Time) ) ) * Base + Offset
High can only be scalar values.
Cycle checks whether these values cross zero, or one. If they do, it will start at that value, and return to that value when done (this is the default value for
ProgressOffset). This allows a smooth return to rest state in animation.
Offset allows you to use
Cycle with non-scalar values. Though be aware not all combinations of value can provide for a smooth return to the rest state.
- Fuse.Animations 1.11.2
Interface of Cycle<T>
The frequency, in hertz, of the wave: how many times per second the cycle repeats.
FrequencyBack : double ux
The frequency, in hertz, to use when animating back towards the rest position.
The highest scalar value in the cycle.
The lowest scalar value in the cycle.
Offset : T ux
ProgressOffset : float ux
Specifies the progress when Cycle should start, and defines the rest state. By default this is calculated to be a suitable rest position to avoid animation jerk when it turns on/off.
Restore : CycleRestore ux
How to return the value to the original/rest state when being played backwards/deactivated.
Target : Property<T> uno
The property that is animated.
Waveform : CycleWaveform ux
The shape of the waveform used in the cycle.
Inherited from OpenAnimator
HasDuration : bool uno
Inherited from Animator
How to mix this animator when there are multiple conflicting animators affecting the target.