Sceneform 动画快速入门
开始使用 Sceneform 动画。本指南将介绍如何执行以下操作:
- 设置开发环境以支持动画
- 在示例应用中加载和运行动画
本指南假定您已安装并配置 Sceneform SDK for Android。否则,请参阅 Android 快速入门中的安装和设置步骤。
如果您不熟悉框架动画,请参阅模型动画概念,查看简介。
设置您的开发环境
构建和运行示例应用
如需构建并运行 Animation 示例应用,请执行以下操作:
将动画示例导入 Android Studio。此文件位于 Sceneform SDK 中的 samples/animation
文件夹中。
如需在 Android Studio 中查看动画资源,请转到 app/sampledata/models
。这些素材资源包括:
andy_dance.fbx
。主要舞蹈 Andy 动画模型。
andy_wave_l.fbx
。Andy 在挥动左侧动画数据。
andy_wave_r.fbx
。Andy 在挥动正确的动画数据。
baseball_cap.fbx
. Andy 的棒球帽。
在 Android Studio 中,点击 Run 图标
。
选择您的设备作为部署目标,然后点击确定以启动示例应用。
在构建流程中,Android Studio 会将素材资源编译为 *.sfb
格式文件。
在您的设备上,为 Animation 示例应用授予相机访问权限。然后,尝试以下步骤:
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2022-09-26。
[null,null,["最后更新时间 (UTC):2022-09-26。"],[[["This guide explains how to set up your development environment for Sceneform animation and run a sample app demonstrating animation."],["You will need Android Studio 3.1 or higher, Android SDK Platform 7.1 or higher, and the Google Sceneform Tools (Beta) plugin installed."],["The sample app allows you to add an animated Andy Android model to an AR scene, trigger animations, and add/remove a hat."],["The provided sample assets include a primary dancing animation, waving animations, and a baseball cap model."],["You can build and run the Animation sample app by importing it into Android Studio and deploying it to a supported ARCore device."]]],["To set up animation development, install Android Studio 3.1+ with Android SDK 7.1+ and the Sceneform Tools plugin. Ensure an Android device is connected. To run the sample app, import the Animation sample from the Sceneform SDK into Android Studio. The app contains animation assets: `andy_dance.fbx`, `andy_wave_l.fbx`, `andy_wave_r.fbx`, and `baseball_cap.fbx`. After building, grant camera access to the app, then tap a plane to add a dancing Andy and use the menu to animate and add/remove a hat.\n"]]