简体   繁体   English

在Android Studio中制作动画

[英]Make an Animation in Android Studio

I know how to create a frame-by-frame animation in Android studio. 我知道如何在Android Studio中创建逐帧动画。 I've been using Paint to create a bunch of images and uploading them in an in order to create a custom animation. 我一直在使用Paint来创建一堆图像,并以的形式上传它们,以创建自定义动画。

However, there must be a better way to do this? 但是,必须有更好的方法吗? Can I use some 2-D animation software to create an animation and then upload it to android studio? 我可以使用某些2-D动画软件来创建动画,然后将其上传到android studio吗?

Any thoughts/suggestions on how to efficiently make custom animations (for example, a guy running)? 关于如何有效制作自定义动画的任何想法/建议(例如,奔跑的家伙)?

you can look at Lottie, perhaps : https://airbnb.design/lottie/ (has support for android and ios) and it greatly improves and enhances these animations too (it converts them to smaller Json files). 您可以查看Lottie,也许是这样的: https : //airbnb.design/lottie/ (支持android和ios),它也大大改善和增强了这些动画(它将它们转换为较小的Json文件)。

here are some examples of what you can do with it : https://lottiefiles.com/ 这是一些您可以使用它的示例: https : //lottiefiles.com/

it's just for small gifs and loading animations, but you can create your own using Adobe After Effects, maybe this helps 它仅用于小gif和加载动画,但是您可以使用Adobe After Effects创建自己的图片,也许这会有所帮助

if you have only few images, then its very simple to do , you just need to create resource file in drawable folder, just use <animation-list> tag and add all images as <item android:drawable="@drawable/seq1" android:duration="100"> with particular delay. 如果您只有很少的图像,则非常简单,只需在drawable文件夹中创建资源文件,只需使用<animation-list>标记并将所有图像添加为<item android:drawable="@drawable/seq1" android:duration="100">并带有特定的延迟。 Like mentioned on official docs . 就像官方文档中提到的那样。 For example: 例如:

<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/selected" android:oneshot="false">
    <item android:drawable="@drawable/ic_camera_arrow_00001" android:duration="200" />
    <item android:drawable="@drawable/ic_camera_arrow_00002" android:duration="200" />
    <item android:drawable="@drawable/ic_camera_arrow_00003" android:duration="200" />
    <item android:drawable="@drawable/ic_camera_arrow_00004" android:duration="200" />
</animation-list>

val frameAnimation = imageView?.drawable as AnimationDrawable
frameAnimation.start()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM