如何解决是否可以将路径动画转换为 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)
}
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。