【问题标题】:Tools for creating AnimatedVectorDrawable用于创建 AnimatedVectorDrawable 的工具
【发布时间】:2016-06-22 23:41:58
【问题描述】:

我真的很喜欢 Android 中添加的 AnimatedVectorDrawable 功能。 有什么好工具可以制作这样的动画吗?

例如任何创建动画的工具like described here

编辑:

到目前为止,我已经找到了这些工具(有点帮助):

【问题讨论】:

  • 您想要生成特定的矢量可绘制对象还是只使用 svg 变形路径?
  • 是的,特别是变形路径。我可以创建 svg,我可以对齐它们,但变形看起来仍然不自然。

标签: android android-animation material-design android-vectordrawable


【解决方案1】:

找到两个很棒的网站。 AndroidIconAnimator,这是一个基于 Web 的工具,用于创建 AnimatedVectorDrawables。还有Shapeshifter,可以很好地控制如何变形路径。

2017 年 7 月 9 日更新

这两种工具现在合并为一个非常好的解决方案。我花了一些时间来了解如何使用它,但是一旦你看到它,它就是一个非常强大的工具

Shapeshifter.design

感谢 2 Roman Nurik 和 Alex Lockwood。

【讨论】:

  • Roman Nurik 和我正计划将我们的两个项目合并在一起(我是制作 Shape Shifter 的人,Roman 制作了 Android Icon Animator),敬请期待。 :)
  • 关于 shape.shifter 的酷教程在这里:medium.com/mobile-app-development-publication/…
【解决方案2】:

您可以使用 Airbnb 的 lottie 库。它将 After Effects 中的动画设计路径传送到适用于 android 的 Animated Vector Drawables。我认为,如果您在 After Effects 中为矢量路径设置动画具有相当的技能,我认为这将是最好的解决方案,因为它具有灵活性。

这是一个描述转换和渲染的完整过程的视频 https://www.youtube.com/watch?v=vs6GOlgUSc8

Airbnb's Lottie Library

使用 Lottie 设计的一些动画图标。

在布局中使用的动画图标

【讨论】:

  • 感谢您的意见。但是,我是一名(爱好)开发人员,希望远离 Adob​​e 的解决方案。
【解决方案3】:

这个问题很老了。我的回答可能会对未来的读者有所帮助。

制作像提问者展示的那样的动画非常简单。我们自己可以创建如图所示的动画。首先,创建一个 VectorDrawable。例如下面:

my_vector_drawable.xml

<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="800dp"
        android:height="800dp"
        android:viewportWidth="800.0"
        android:viewportHeight="800.0">

    <path
        android:name="a_circle"
        android:pathData="M  250   200
        q   -86     02    -140     57.5
        t   -57    135.5
        q   -03     93      67    156
        q    59     52     135     50
        q    71    -02     132    -54
        q    66    -56      66   -146
        q    00    -80     -45   -129
        q   -68    -72    -158    -70   "

        android:strokeLineCap="round"
        android:strokeColor="#f00f"
        android:fillColor="#00000000"
        android:trimPathEnd="0"
        android:strokeWidth="32"/>



</vector>

my_animated_vector_drawable.xml

<?xml version="1.0" encoding="utf-8"?>
<animated-vector
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:aapt="http://schemas.android.com/aapt"
    android:drawable="@drawable/my_vector_drawable">

    <target
        android:name="a_circle"
        android:animation="@animator/my_animation"/>

</animated-vector>

my_animation.xml

<?xml version="1.0" encoding="utf-8"?>
<set
    xmlns:android="http://schemas.android.com/apk/res/android">
    <objectAnimator
        android:propertyName="trimPathEnd"
        android:duration="1000"
        android:valueFrom="0"
        android:valueTo="1"
        android:repeatCount="0"
        android:repeatMode="restart"/>
</set>

第一个文件包含图片数据。第三个文件包含动画数据。第二个文件链接第一个和第二个。

您可以创建三个空白文件。将上面给出的内容复制并粘贴到您的文件中。

您将前两个文件放在可绘制文件夹中。第三个放在“animator”文件夹中。这两个文件夹都在 res 文件夹中找到了位置。

您可以创建一个包含 ImageView 的布局文件。您可以将 AnimatedVectorDrawable 文件作为可绘制对象 (android:src="my_animated_vector_drawable")。

在您的活动中将内容视图设置为布局。另外,给 ImageView 充气。

(myImage=((ImageView)findViewById(R.id.yourimageview name);
myImage.getDrawable.start():

然后看看乐趣。 AnimatedVectorDrawable 文件中可以有多个目标。在set下的动画文件中可以有多个ObjectAnimator...

您问题中显示的动画是路径变形。文档中也有路径变形示例,这也很简单。我把它留给你去试验。

【讨论】:

  • 谢谢,但我更喜欢 shapeshifter.design,因为我需要 5 个以上的矢量来单独制作动画
猜你喜欢
  • 1970-01-01
  • 2020-12-11
  • 2021-08-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多