Skip to content

Class Transition

Definition

Namespace: StardewUI.Animation
Assembly: StardewUI.dll

Describes the transition behavior of a single property.

[StardewUI.DuckType]
public record Transition : IEquatable<StardewUI.Animation.Transition>

Inheritance
Object ⇦ Transition

Implements
IEquatable<Transition>

Members

Constructors

Name Description
Transition(TimeSpan, TimeSpan, Easing) Describes the transition behavior of a single property.
Transition(TimeSpan?, TimeSpan?, Easing) Initializes a new Transition instance.

Fields

Name Description
Default A Transition instance with all values set to their defaults.
DefaultDelay Default delay (zero) for transitions not specifying an explicit delay.
DefaultDuration Default duration (1 second) for transitions not specifying an explicit duration.
DefaultEasing Default easing (linear) for transitions not specifying an explicit easing function.

Properties

Name Description
Delay Delay during which to hold the current value before transitioning to the new value.
Duration Duration of the transition.
Easing Type of easing or acceleration curve for the transition.
EqualityContract
TotalDuration The total duration of the transition, including both the animation itself and any pre-delay.

Methods

Name Description
GetPosition(TimeSpan) Computes the interpolation position for this transition, given the time elapsed since the transition was first triggered.
Parse(string) Parses a Transition value from a string value.
Parse(ReadOnlySpan<Char>) Parses a Transition value from a string value.
TryParse(ReadOnlySpan<Char>, Transition) Attempts to parse a Transition value from a string value.

Details

Constructors

Transition(TimeSpan, TimeSpan, Easing)

Describes the transition behavior of a single property.

public Transition(System.TimeSpan Duration, System.TimeSpan Delay, StardewUI.Animation.Easing Easing);
Parameters

Duration   TimeSpan
Duration of the transition.

Delay   TimeSpan
Delay during which to hold the current value before transitioning to the new value.

Easing   Easing
Type of easing or acceleration curve for the transition.


Transition(TimeSpan?, TimeSpan?, Easing)

Initializes a new Transition instance.

public Transition(System.TimeSpan? duration, System.TimeSpan? delay, StardewUI.Animation.Easing easing);
Parameters

duration   Nullable<TimeSpan>
Duration of the transition. If not specified, the transition will use the DefaultDuration.

delay   Nullable<TimeSpan>
Delay during which to hold the current value before transitioning to the new value. If not specified, the transition will use the DefaultDelay.

easing   Easing
Type of easing or acceleration curve for the transition. If not specified, the transition will use the DefaultEasing.


Fields

Default

A Transition instance with all values set to their defaults.

public static readonly StardewUI.Animation.Transition Default;
Field Value

Transition


DefaultDelay

Default delay (zero) for transitions not specifying an explicit delay.

public static readonly System.TimeSpan DefaultDelay;
Field Value

TimeSpan


DefaultDuration

Default duration (1 second) for transitions not specifying an explicit duration.

public static readonly System.TimeSpan DefaultDuration;
Field Value

TimeSpan


DefaultEasing

Default easing (linear) for transitions not specifying an explicit easing function.

public static readonly StardewUI.Animation.Easing DefaultEasing;
Field Value

Easing


Properties

Delay

Delay during which to hold the current value before transitioning to the new value.

public System.TimeSpan Delay { get; set; }
Property Value

TimeSpan


Duration

Duration of the transition.

public System.TimeSpan Duration { get; set; }
Property Value

TimeSpan


Easing

Type of easing or acceleration curve for the transition.

public StardewUI.Animation.Easing Easing { get; set; }
Property Value

Easing


EqualityContract

protected System.Type EqualityContract { get; }
Property Value

Type


TotalDuration

The total duration of the transition, including both the animation itself and any pre-delay.

public System.TimeSpan TotalDuration { get; }
Property Value

TimeSpan


Methods

GetPosition(TimeSpan)

Computes the interpolation position for this transition, given the time elapsed since the transition was first triggered.

public float GetPosition(System.TimeSpan elapsed);
Parameters

elapsed   TimeSpan
Time elapsed since the transition was initiated.

Returns

Single

The interpolation amount or "y position" at the specified time.

Remarks

The value is independent of the type of property being transitioned, or how it is interpolated; the result is intended to be used as the amount argument to a Lerp<T> delegate.


Parse(string)

Parses a Transition value from a string value.

public static StardewUI.Animation.Transition Parse(string value);
Parameters

value   string
The string value to parse.

Returns

Transition

The parsed transition.


Parse(ReadOnlySpan<Char>)

Parses a Transition value from a string value.

public static StardewUI.Animation.Transition Parse(ReadOnlySpan<System.Char> value);
Parameters

value   ReadOnlySpan<Char>
The string value to parse.

Returns

Transition

The parsed transition.


TryParse(ReadOnlySpan<Char>, Transition)

Attempts to parse a Transition value from a string value.

public static bool TryParse(ReadOnlySpan<System.Char> value, out StardewUI.Animation.Transition result);
Parameters

value   ReadOnlySpan<Char>
The string value to parse.

result   Transition
The parsed transition, if successful; otherwise null.

Returns

Boolean

true if the value was parsed successfully, otherwise false.