【问题标题】:Convert SVG into android animated vector drawables将 SVG 转换为 android 动画矢量绘图
【发布时间】:2020-04-11 02:22:53
【问题描述】:

如何将此 SVG 文件转换为可绘制的动画矢量,以便 android 显示在活动图像上。

SVG 文件

<svg width="38" height="38" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" stroke="#E31F64">
    <g fill="none" fill-rule="evenodd">
        <g transform="translate(1 1)" stroke-width="2">
            <circle stroke-opacity=".5" cx="18" cy="18" r="18"/>
            <path d="M36 18c0-9.94-8.06-18-18-18">
                <animateTransform
                    attributeName="transform"
                    type="rotate"
                    from="0 18 18"
                    to="360 18 18"
                    dur="1s"
                    repeatCount="indefinite"/>
            </path>
        </g>
    </g>
</svg>

我使用了一些在线工具来转换它,但它们只是创建了一个矢量而不是动画矢量 这是向量

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

    <group
            android:translateX="1"
            android:translateY="1">
        <path
            android:fillType="evenOdd"
            android:strokeAlpha=".5"
            android:strokeWidth="2"
            android:pathData="M 18 0 C 27.941125497 0 36 8.05887450305 36 18 C 36 27.941125497 27.941125497 36 18 36 C 8.05887450305 36 0 27.941125497 0 18 C 0 8.05887450305 8.05887450305 0 18 0 Z" />
        <path
            android:fillType="evenOdd"
            android:strokeWidth="2"
            android:pathData="M36 18c0-9.94-8.06-18-18-18" />

    </group>
</vector> 

我如何创建动画来显示旋转的椭圆。

谢谢

【问题讨论】:

    标签: android android-animation svg-animate


    【解决方案1】:

    使用ShapeShifter 工具创建动画矢量绘图。这是一个非常基本的工具,但可以满足需求。

    【讨论】:

    • 我尝试了 ShapeShifter 工具,但它也无法读取填充颜色和动画
    • 导入 SVG 后,为 path_2 创建一个图层组。将 path_2 组旋转到中心。应用从 0 到 360 的旋转动画。另外,删除填充颜色并在描边颜色中提及颜色。
    猜你喜欢
    • 2020-10-13
    • 2010-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-14
    • 1970-01-01
    • 2023-04-11
    • 1970-01-01
    相关资源
    最近更新 更多