Class SmoothTimeScaleTransition
Drives an eased transition of a base time-scale value from a starting value to a target value over a fixed real-time duration. Used by TransitionTimeScale(float, float, Action, Func<float, float>) to replace abrupt time-scale changes with a smooth blend.
Inherited Members
Namespace: Scylla.Core.Time
Assembly: ScyllaCore.dll
Syntax
public sealed class SmoothTimeScaleTransition
Remarks
The transition is driven from outside via Update(float), which is called every
tick by ScyllaTime. Once the elapsed real time reaches the configured
duration the transition completes, fires its optional OnComplete callback, and
self-cancels.
The default easing function is SmoothStep(float) (cubic Hermite
smoothstep, t -> 3t^2 - 2t^3). Callers may pass any Func<float, float>
that maps [0,1] to [0,1]; both endpoints should remain at exactly
0 and 1 for the start and target values to be reached precisely.
Allocation: zero per tick once the transition is constructed (the easing function is invoked on a primitive float; no boxing).
Constructors
SmoothTimeScaleTransition(float, float, float, Action<float>, Action, Func<float, float>)
Create a new transition. The transition begins inactive at construction time; ScyllaTime drives it forward via Update(float).
Declaration
public SmoothTimeScaleTransition(float startValue, float targetValue, float duration, Action<float> onUpdate = null, Action onComplete = null, Func<float, float> easing = null)
Parameters
| Type | Name | Description |
|---|---|---|
| float | startValue | The value at |
| float | targetValue | The value at |
| float | duration | Real-time seconds the transition should take. Values |
| Action<float> | onUpdate | Optional per-tick callback receiving the current eased value. |
| Action | onComplete | Optional callback invoked once when the transition reaches its target. |
| Func<float, float> | easing | Optional easing function mapping |
Properties
CurrentValue
The current eased value as of the last Update(float) call. Starts at the configured start value, ends at the configured target value.
Declaration
public float CurrentValue { get; }
Property Value
| Type | Description |
|---|---|
| float |
IsComplete
true after the transition has reached or passed its duration, or after
Cancel() was called. Once true the instance no longer mutates state
in Update(float).
Declaration
public bool IsComplete { get; }
Property Value
| Type | Description |
|---|---|
| bool |
WasCancelled
true if Cancel() was invoked before the transition naturally
completed. The OnComplete callback is not invoked when cancelled.
Declaration
public bool WasCancelled { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
Cancel()
Stops the transition early. CurrentValue retains its last computed
value. The OnComplete callback is suppressed.
Declaration
public void Cancel()
Update(float)
Advance the transition by unscaledDeltaTime real seconds.
Does nothing once the transition has completed or been cancelled.
Declaration
public void Update(float unscaledDeltaTime)
Parameters
| Type | Name | Description |
|---|---|---|
| float | unscaledDeltaTime |