Table of Contents

Class FillImageScroller

Namespace
Fallencake.UI
Assembly
Fallencake.UI.dll

Specialized scroller that animates a fill by moving a UnityEngine.RectTransform's Y position according to a numeric value mapped between configurable minimum and maximum offsets.

public class FillImageScroller : AnimatedImageScroller
Inheritance
object
Object
Component
Behaviour
MonoBehaviour
FillImageScroller
Inherited Members

Examples

Quick setup in code:

var scroller = gameObject.AddComponent<FillImageScroller>();
scroller.SetScrollableImages(myImages); // inherited UV scrolling if needed
scroller.FillTransform = myFillRect;    // RectTransform to move vertically
scroller.MinValue = 0f;
scroller.MaxValue = 100f;
scroller.MinFillOffset = 0f;
scroller.MaxFillOffset = 120f;
scroller.UseAutoHeight = true;         // anchors/pivot/height configured automatically
scroller.Value = 65f;                   // updates Y position immediately

Remarks

Inherits scrolling support from AnimatedImageScroller for texture UV movement, and augments it with a vertical fill behavior driven by Value. The fill position is calculated using UnityEngine.Mathf.InverseLerp(float, float, float) over the MinValueMaxValue range and then mapped to the MinFillOffsetMaxFillOffset Y offsets via UnityEngine.Mathf.Lerp(float, float, float).

When UseAutoHeight is enabled, the component configures anchors, pivot and height of the FillTransform for standard bottom-up filling by calling an internal setup routine (anchors (0,0)-(1,0), pivot.y = 1, height = MaxFillOffset), then applies only Y offset changes via UnityEngine.RectTransform.anchoredPosition while preserving X.

Properties

FillTransform

Target UnityEngine.RectTransform whose UnityEngine.RectTransform.anchoredPosition.y is updated to visualize the fill according to Value.

public RectTransform FillTransform { get; set; }

Property Value

RectTransform

Assign the transform that should move vertically to represent the fill. Setting this property immediately re-applies the current Value via FillValue(float).

MaxFillOffset

Maximum Y offset (in local anchored space) for FillTransform when Value equals MaxValue.

public float MaxFillOffset { get; set; }

Property Value

float

Updating this property immediately reapplies the current Value. When UseAutoHeight is enabled, this value also defines the transform height via UnityEngine.RectTransform.SetSizeWithCurrentAnchors(UnityEngine.RectTransform.Axis, float).

MaxValue

Maximum value of the logical range that corresponds to MaxFillOffset.

public float MaxValue { get; set; }

Property Value

float

Changing this revalidates Value to keep it within bounds and updates visuals if needed.

MinFillOffset

Minimum Y offset (in local anchored space) for FillTransform when Value equals MinValue.

public float MinFillOffset { get; set; }

Property Value

float

Updating this property immediately reapplies the current Value.

MinValue

Minimum value of the logical range that corresponds to MinFillOffset.

public float MinValue { get; set; }

Property Value

float

Changing this revalidates Value to keep it within bounds and updates visuals if needed.

UseAutoHeight

Enables automatic height and layout configuration for the FillTransform.

public bool UseAutoHeight { get; set; }

Property Value

bool

When enabled, anchors are set to (0,0)–(1,0), UnityEngine.RectTransform.pivot.y becomes 1, position is reset to zero, and height is set to MaxFillOffset so that the Y offset directly represents the fill level.

Value

Current fill value clamped within MinValueMaxValue.

public float Value { get; set; }

Property Value

float

Assigning a value updates the fill immediately by calling FillValue(float). The value is clamped to the valid range.

Remarks

The mapping uses UnityEngine.Mathf.InverseLerp(float, float, float) to compute a normalized factor and then UnityEngine.Mathf.Lerp(float, float, float) to produce the Y offset between MinFillOffset and MaxFillOffset.

Methods

FillValue(float)

Recomputes and applies the FillTransform's Y offset to reflect the specified value.

public void FillValue(float value)

Parameters

value float

The value to map into the MinValueMaxValue range.

Remarks

The value is normalized using UnityEngine.Mathf.InverseLerp(float, float, float) and then mapped to MinFillOffsetMaxFillOffset via UnityEngine.Mathf.Lerp(float, float, float). When UseAutoHeight is enabled, auto-height configuration is applied beforehand.

Only the Y component of UnityEngine.RectTransform.anchoredPosition is changed; the X component remains unchanged to preserve horizontal alignment.

Start()

Unity Start lifecycle method.

protected override void Start()

Remarks

Invokes base initialization from AnimatedImageScroller and then applies the initial Value to position the FillTransform.

See Also