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">
        <Cycle Target="panel1.Width" Low="80" High="120" Frequency="0.5"/>

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

Low and 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.

Modifying Base and 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 2.4.0
Show Uno properties and methods

Interface of Cycle<T>

Base : T ux

Applied as a multiplier to the progress value. This allows using Cycle on properties that are not scalars, such as float2.

Easing : Easing ux

Specifies an easing applied to the waveform value. The default is Linear, meaning the waveform range of 0...1 is used directly (mapped to the Low ... High range). An Easing provides a different mapping for the values.

Frequency : double ux

The frequency, in hertz, of the wave: how many times per second the cycle repeats.

Offset : T ux

Specifies the offset value applied to the Value formula.

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.

Inherited from OpenAnimator

Inherited from Animator

Delay : double ux

Seconds from the start of the trigger until this animator should play.

MixOp : MixOp ux

How to mix this animator when there are multiple conflicting animators affecting the target.

Inherited from PropertyObject

Inherited from object

Attached UX Attributes

GlobalKey (attached by Resource) : string ux

The ux:Global attribute creates a global resource that is accessible everywhere in UX markup.