Animator

class Animator(uiElement: UIElement)

The Animator class is responsible for a UIElement animations

Each UIElement has a single UIElement.animator object that handles its animations

The animator modifies the uiElement transformations, like UIElement.scale, UIElement.translateBy, UIElement.rotate, according to its configuration

NOTE:

  1. Applying additional transformations during animation may result in unexpected behavior

  2. When the animation has ended, consider calling UIElement.resetTransformations to reset the transformation state or apply the new position to the UIElement, for example, by passing the Animator.getCurrentX value to the UIElement.setX method

The SDK will do its best effort to perform animations as fast as possible, but the communication bandwidth and the amount of rendered elements may have an impact on the animation rendering performance

Animation might be laggy when uploading assets to the glasses (like images and fonts)

Constructors

Link copied to clipboard
constructor(uiElement: UIElement)

Types

Link copied to clipboard

Interface for receiving animation events

Functions

Link copied to clipboard
fun blink(intervalMs: Long): Animator

Start blinking the ui element every intervalMs

fun blink(intervalOffMs: Long, intervalOnMs: Long): Animator

Start blinking the ui element

Link copied to clipboard

The animation will reverse infinitely, until cancel is called

Link copied to clipboard

Cancels the animation.

Link copied to clipboard

Sets the animation duration in milliseconds. Default is 1000ms

Link copied to clipboard
fun estimatePositionAt(timestamp: Long): Point

Helper function to estimate to animator translation x,y position at a certain percent

Link copied to clipboard

Receive the current rotation associated with the current animation progress getProgress

Link copied to clipboard

Receive the current scale x associated with the current animation progress getProgress

Link copied to clipboard

Receive the current scale y associated with the current animation progress getProgress

Link copied to clipboard

Receive the current x position associated with the current animation progress getProgress

Link copied to clipboard

Receive the current y position associated with the current animation progress getProgress

Link copied to clipboard

Receive the current animation progress 0,1

Link copied to clipboard

Returns true if the UIElement is blinking

Link copied to clipboard

Indicates if the animation is active.

Link copied to clipboard

Register for animation events.

Link copied to clipboard

The animation will repeat infinitely, until cancel is called

Link copied to clipboard

The animation will reverse ONCE before end

Link copied to clipboard
fun rotate(angleDegrees: Float): Animator
fun rotate(angleDegrees: Float, px: Float, py: Float): Animator
fun rotate(angleDegrees: Float, px: Float, py: Float, pivot: Pivot): Animator

Sets the target rotation angle animation value

Link copied to clipboard
fun scale(scaleFactor: Float): Animator

Sets the target scale x and y animation values

Link copied to clipboard
fun scaleX(scaleFactor: Float): Animator

Sets the target scale x animation value

Link copied to clipboard
fun scaleY(scaleFactor: Float): Animator

Sets the target scale y animation value

Link copied to clipboard

Start the animation

Link copied to clipboard

Sets the target translation x and y animation values

Link copied to clipboard

Sets the target translation x and y animation values

Link copied to clipboard

Unregister from animation events.