DiceAnimation

class DiceAnimation<T : DiceView>(    dice: T,     val toSide: Int,     duration: Int = DEFAULT_ANIMATION_DURATION,     speed: Int = DEFAULT_ANIMATION_SPEED) : SteppedComponentAnimation<T>

A dice roll Animation.

Shuffles through die visuals for given duration and shows toSide in the end. Use the speed parameter to define how many steps the animation should have.

For example:

An animation with duration = 1s and speed = 50 will change the visual 50 times within the duration of one second.

Parameters

T

Generic DiceView.

dice

DiceView to animate.

duration

Duration in milliseconds. Default: DEFAULT_ANIMATION_DURATION.

speed

Count of steps. Default: DEFAULT_ANIMATION_SPEED.

Constructors

Link copied to clipboard
fun <T : DiceView> DiceAnimation(    dice: T,     toSide: Int,     duration: Int = DEFAULT_ANIMATION_DURATION,     speed: Int = DEFAULT_ANIMATION_SPEED)

Creates a DiceAnimation for the given DiceView.

Properties

Link copied to clipboard
val componentView: T

ComponentView to animate.

Link copied to clipboard
val duration: Int

Duration in milliseconds.

Link copied to clipboard
var isRunning: Boolean

Boolean indicating whether the Animation is currently running.

Link copied to clipboard
var onFinished: (AnimationFinishedEvent) -> Unit?

Gets invoked when Animation has finished.

Link copied to clipboard
val speed: Int

Speed in steps.

Link copied to clipboard
val toSide: Int

Resulting side after roll.