The AnimationController element has the following attributes:
Required attributes
The following attributes are required:
play
An event trigger type which determines when the animation plays. Possible
values include the following:
TAP: The animation plays when the user taps on the element.
ON_VISIBLE: The animation plays when the element next becomes visible.
ON_NEXT_SECOND: The animation plays when the next second begins.
ON_NEXT_MINUTE: The animation plays when the next minute begins.
ON_NEXT_HOUR: The animation plays when the next hour begins.
Optional attributes
The following attributes are optional:
delayPlay
A delay in seconds before the animation plays. Defaults to 0.
delayRepeat
A delay in seconds before an animation repeats. Defaults to 0.
repeat
Whether to repeat the animation when it finishes, playing it indefinitely.
Defaults to FALSE.
loopCount
How many times to repeat an animation before it stops. If repeat is set to
TRUE, it takes precedence and this value is ignored. Defaults to 1.
resumePlayBack
Animations pause when the watch face is not visible. If resumePlayBack
is TRUE, the animation continues from the same frame that was shown when the
watch face previously became not visible. If resumePlayBack is set to FALSE,
the animation restarts from the beginning when the watch face becomes visible
again. Defaults to FALSE.
beforePlaying, afterPlaying
Define the state of the animation element before it can play, or after it has
finished. These attributes can be set to the following values:
DO_NOTHING causes no change to the rendered state of the element.
FIRST_FRAME fixes the rendering of the element to the first frame of the
animation.
THUMBNAIL fixes the rendering of the element to the thumbnail resource
provided by the animated resource.
HIDE hides the animation.
Both attributes default to DO_NOTHING.
Recommended for you
Note: link text is displayed when JavaScript is off
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-05-20 UTC.
[null,null,["Last updated 2025-05-20 UTC."],[],[],null,["# AnimationController\n\nWatch Face Format version Version 4 Version 3 Version 2 Version 1\n\n*** ** * ** ***\n\nAn animation controller controls the playback of animations on the watch face.\n\nSyntax\n------\n\n```xml\n\u003cAnimationController play=\"TAP | ON_VISIBLE | ON_NEXT_SECOND |\n ON_NEXT_MINUTE | ON_NEXT_HOUR\"\n delayPlay=\"float\" delayRepeat=\"float\n repeat=\"boolean\" loopCount=\"integer\"\n resumePlayBack=\"boolean\" beforePlaying=\"string\"\n afterPlaying=\"string\" /\u003e\n```\n\nAttributes\n----------\n\nThe `AnimationController` element has the following attributes:\n\n### Required attributes\n\nThe following attributes are required:\n\n`play`\n\n: An event trigger type which determines when the animation plays. Possible\n values include the following:\n\n - `TAP`: The animation plays when the user taps on the element.\n - `ON_VISIBLE`: The animation plays when the element next becomes visible.\n - `ON_NEXT_SECOND`: The animation plays when the next second begins.\n - `ON_NEXT_MINUTE`: The animation plays when the next minute begins.\n - `ON_NEXT_HOUR`: The animation plays when the next hour begins.\n\n### Optional attributes\n\nThe following attributes are optional:\n\n`delayPlay`\n: A delay in seconds before the animation plays. Defaults to 0.\n\n`delayRepeat`\n: A delay in seconds before an animation repeats. Defaults to 0.\n\n`repeat`\n: Whether to repeat the animation when it finishes, playing it indefinitely.\n Defaults to `FALSE`.\n\n`loopCount`\n: How many times to repeat an animation before it stops. If `repeat` is set to\n `TRUE`, it takes precedence and this value is ignored. Defaults to 1.\n\n`resumePlayBack`\n: Animations pause when the watch face is not visible. If `resumePlayBack`\n is `TRUE`, the animation continues from the same frame that was shown when the\n watch face previously became not visible. If `resumePlayBack` is set to `FALSE`,\n the animation restarts from the beginning when the watch face becomes visible\n again. Defaults to `FALSE`.\n\n`beforePlaying`, `afterPlaying`\n\n: Define the state of the animation element before it can play, or after it has\n finished. These attributes can be set to the following values:\n\n - `DO_NOTHING` causes no change to the rendered state of the element.\n - `FIRST_FRAME` fixes the rendering of the element to the first frame of the animation.\n - `THUMBNAIL` fixes the rendering of the element to the thumbnail resource provided by the animated resource.\n - `HIDE` hides the animation.\n\nBoth attributes default to `DO_NOTHING`.\n\nRecommended for you\n-------------------\n\n- Note: link text is displayed when JavaScript is off\n- [AnimatedImages](/training/wearables/wff/group/part/animated-image/animated-images)\n- [Images](/training/wearables/wff/v2/group/part/image/images)\n- [Images](/training/wearables/wff/group/part/image/images)"]]