DampedTransitioner

open class DampedTransitioner<T>(timer: Timer, scheduler: AnimationScheduler, decelerationTime: Measure<Time> = 1 * seconds, dampLevel: Measure<InverseUnits<Time>> = 10 / seconds) : CarouselBehavior.Transitioner<T> (source)

Carousel Transitioner that provides smooth, physics-based deceleration at the end of a Carousel's manual movement.

Parameters

timer

used to track current time

scheduler

used to manage animation

decelerationTime

indicating how quickly stops should decelerate to 0 velocity

dampLevel

indicating how much critical damping should be applied during stopping

See also

Constructors

Link copied to clipboard
constructor(timer: Timer, scheduler: AnimationScheduler, decelerationTime: Measure<Time> = 1 * seconds, dampLevel: Measure<InverseUnits<Time>> = 10 / seconds)

Functions

Link copied to clipboard
open override fun moveEnded(carousel: Carousel<T, *>, position: Vector2D, markers: Carousel.ItemMarkers, decelerateWhile: (Vector2D) -> Carousel.ItemMarkers): Completable

Notified whenever carousel has ended a manual move. This is where a transition animation would take place to smoothly move to the desired end item.

Link copied to clipboard
open override fun moveStarted(carousel: Carousel<T, *>, position: Vector2D)

Notified whenever carousel has started a manual move. This is a good point for Transitioners to start tracking movement state if they wish to provide smooth animation when moveEnded is called.

Link copied to clipboard
open override fun moveUpdated(carousel: Carousel<T, *>, position: Vector2D)

Notified whenever carousel has moves during a manual move (called after moveStarted). Transitioners can use this to keep track of things like movement velocity if they wish to provide smooth animation when moveEnded is called.

Inherited functions

Link copied to clipboard
open fun transition(carousel: Carousel<T, *>, startItem: Int, endItem: Int, update: (progress: Float) -> Unit): Pausable

Defines how a Carousel should transition between items. The default is to instantaneously jump between items. But this API allows for animating this movement.