Variant


Allows watch face creators to define modified appearances, by changing the values of specific color and geometric properties, when the Wear OS device is in different display modes. As of Wear OS 4, the only supported mode is ambient mode.

Introduced in Wear OS 4.

Syntax

<Variant mode="AMBIENT" target="attribute-name" value="valid-value" />

Attributes

The Variant element has the following required attributes:

mode

The mode that the Wear OS device must be in for the variant to take effect.

As of Wear OS 4, this value must be AMBIENT.

target

The attribute whose value should change when the specified Wear OS device mode takes effect. This must be a transformable attribute.

value

The value that the attribute should have when the specified Wear OS device mode takes effect.

Optional attributes

The following attributes are optional:

duration
Starting with version 4, the transition between interactive and ambient states is animated. The duration attribute takes values between 0.0 and 1.0 to control how long this animation takes, where 1.0 is the full extent allowed by the device, and is the default value. 0.0 represents no animation.
startOffset

Controls the delay before the start of the transition animation, taking a value in the range 0.0 to 1.0. The default is 0.0.

If the sum of duration and startOffset is greater than 1.0, then startOffset is ignored.

Example: Starting an animation halfway through the ambient to interactive transition, and using the full extent of the time available:

<Variant mode="AMBIENT" target="x" value="100" startOffset="0.5" duration="0.5"/>
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 the animation. Possible values include the following:

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