是否可以将路径动画转换为 mp4 视频并在 android 中导出

问题描述

如何转换导出并将路径动画保存为视频/mp4 文件? 我使用这个库来创建动画 https://github.com/totond/TextPathView/blob/master/README-en.md。 我想在不投屏的情况下录制动画。

 <?xml version="1.0" encoding="utf-8"?>
 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".TestActivity">



<yanzhikai.textpath.SyncTextPathView
    android:id="@+id/test2"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    app:duration="6000"

    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/spv"
    app:paintstrokeColor="#F44336"
    app:pathstrokeColor="#F44336"
    app:showPainter="true"
    app:text="Android"
    app:textInCenter="true"
    app:textSize="75sp" />



<Button
    android:id="@+id/button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="8dp"
    android:text="Start"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

活动代码

class TestActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_test)

    spv.setPath(yanzhikai.textpathview.path.TestPath())
    spv.setPathPainter(FireworksPainter())
    test.setPathPainter(FireworksPainter())
    test2.setPathPainter(FireworksPainter())
    button.setonClickListener {
        test.startAnimation(0f,1f)
        test2.startAnimation(0f,1f)
        spv.startAnimation(0f,1f)

    }
}

}

path animation

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)