Animation


Applies an animation to the parent Transform element within the watch face XML file. In cases where a Transform element changes the value of a specific attribute, a child Animation element updates the changed value gradually on the watch face.

Introduced in Wear OS 4.

Syntax

<Transform ...>
    <!-- Only the "duration" attribute is required. -->
    <Animation interpolation="LINEAR | EASE_IN | EASE_OUT | EASE_IN_OUT |
               OVERSHOOT | CUBIC_BEZIER" controls="four-component-vector"
               angleDirection="NONE | CLOCKWISE | COUNTER_CLOCKWISE"
               repeat="integer" fps="integer"
               duration="float">
    </Animation>
</Transform>

Attributes

The Animation element has the following attributes:

Required attributes

The following attributes are required:

duration
The duration of the animation, in seconds. This attribute is required.

Optional attributes

The following attributes are optional:

interpolation

The interpolation method to use for this animation. Possible values include the following:

  • LINEAR (default)
  • EASE_IN
  • EASE_OUT
  • EASE_IN_OUT
  • OVERSHOOT
  • CUBIC_BEZIER
controls

A 4-component vector that represents the position of the control points for the animation. The default value is <0.5, 0.5, 0.5, 0.5>.

This attribute takes effect only when interpolation is set to CUBIC_BEZIER.

angleDirection

The direction to use when applying angular rotation to this animation. Possible values include the following:

  • NONE (default): No angular rotation
  • CLOCKWISE: Animate in the clockwise direction
  • COUNTER_CLOCKWISE: Animate in the counterclockwise direction
repeat

Indicates the number of times that the animation should repeat. A value of 0 (the default value) causes the animation to never repeat. A value of -1 means the animation will loop indefinitely.

fps

The animation rate, in frames per second. The default value is 15.