# Introducing Vectordrawable-Seekable

DevFeed: [Introducing Vectordrawable-Seekable](<https://devfeed.tech/articles/introducing-vectordrawable-seekable-23103.md>)

Original publisher: [Read original article](<https://medium.com/android-news/introducing-vectordrawable-seekable-b96ef57ffe36?source=rss----8fca399d4de---4>)

Author: Alistair Sykes

Published: 2020-05-11T13:35:28Z

Content type: tutorial

Language: en

Sources: [Android & Tech News -- Medium](<https://devfeed.tech/sources/android-tech-news-medium.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [media3](<https://devfeed.tech/topics/media3.md>), [XML](<https://devfeed.tech/topics/xml.md>), [Library](<https://devfeed.tech/topics/library.md>), [SDK](<https://devfeed.tech/topics/sdk.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [animation](<https://devfeed.tech/tags/animation.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [library](<https://devfeed.tech/tags/library.md>), [material-design](<https://devfeed.tech/tags/material-design.md>), [play](<https://devfeed.tech/tags/play.md>), [repeat](<https://devfeed.tech/tags/repeat.md>), [rotation](<https://devfeed.tech/tags/rotation.md>), [screen](<https://devfeed.tech/tags/screen.md>), [vector](<https://devfeed.tech/tags/vector.md>), [xml](<https://devfeed.tech/tags/xml.md>)

## AI overview

This tutorial introduces the Vectordrawable-Seekable library for Android. It explains how Core-Animation and SeekableAnimatedVectorDrawable add pause and seek controls to animated vector drawables, then demonstrates creating vector, animation, and drawable XML resources and displaying the result.

## Source excerpt

Using the new and improved AnimatedVectorDrawable to pause and seek your animations.AnimatedVectorDrawable Android SDK 21 introduced both the VectorDrawable and the AnimatedVectorDrawable. This allowed you to use vector assets within your app, and even animate them. They've iterated on these since then, but AnimatedVectorDrawable was still missing something. You couldn't manipulate and control the animation. There was no pause or seek functionality. Core-Animation The Android team has been hard at work backporting the framework Animator APIs. They have created a separate unbundled AndroidX library called Core-Animation. The Animator APIs have been around for some time. But they didn't provide the capabilities needed for this pause and seek functionality. So they needed to be unbundled and then iterated on. Vectordrawable-Seekable Once Core-Animation was available the Android team could create the Vectordrawable-Seekable library. This library revolves around the class SeekableAnimatedVectorDrawable. Under the hood, this class uses the AnimatorSet and subsequently Animator from Core-Animation. These provide the pause and seek functionality. How toCreate the vector Firstly, you need a vector asset of the image you wish to animate. This works best if it is simple and optimised. See these resources for information on optimising assets: - https://www.brightec.co.uk/blog/creating-vector-drawables-android - https://arturdryomov.dev/posts/optimizing-android-vector-images/ For this example I am going to use an Android: https://medium.com/media/c1f49ee65961374471c7019479d595cf/href This XML file should be placed in your res/drawable directory. Notice the group names, as these allow us to reference each part of the image later. Notice also the pivot points defined. These define the pivot around which rotation would happen. Create the animation To define the animation itself you can create another XML file. This defines an ObjectAnimator. https://medium.com/media/51350379510a257