Table of Contents

Class AnimatedImageScroller

Namespace
Fallencake.UI
Assembly
Fallencake.UI.dll

Drives continuous UV scrolling for a collection of ScrollableImage items.

public class AnimatedImageScroller : MonoBehaviour
Inheritance
object
Object
Component
Behaviour
MonoBehaviour
AnimatedImageScroller
Derived

Examples

Assign a list of images and toggle scrolling:

var scroller = GetComponent<AnimatedImageScroller>();
scroller.SetScrollableImages(new List<ScrollableImage> { item1, item2 });
scroller.IsScrolling = true; // start

Remarks

On Start(), the component calls Init() to prepare all images. While IsScrolling is true, Update() advances UV offsets for each image every frame by calling UpdateOffset().

Fields

_isScrolling

[SerializeField]
protected bool _isScrolling

Field Value

bool

_scrollableImages

[SerializeField]
protected List<ScrollableImage> _scrollableImages

Field Value

List<ScrollableImage>

Properties

IsScrolling

Whether the scroller should advance UV offsets each frame.

public bool IsScrolling { get; set; }

Property Value

bool

true to update all configured ScrollableImage instances in Update(); false to pause scrolling.

Methods

Init()

Initializes the scroller by calling Init() on each item.

protected virtual void Init()

SetScrollableImages(List<ScrollableImage>)

Replaces the current collection of images to be scrolled.

public virtual void SetScrollableImages(List<ScrollableImage> scrollableImages)

Parameters

scrollableImages List<ScrollableImage>

The list of ScrollableImage items to manage and animate.

Start()

Unity lifecycle hook. Prepares all configured ScrollableImage instances.

protected virtual void Start()

Update()

Unity lifecycle hook. Advances scrolling each frame while IsScrolling is true.

protected virtual void Update()