UnityAPI手册-2019.4官网版
文集大纲加载中……
本文档使用 MrDoc 发布
-
+
首页
Animation 动画组件用于播放动画
# Animation class in UnityEngine / 继承自:[Behaviour](Behaviour.html) ## 描述 动画组件用于播放动画。 您可以将动画剪辑分配给动画组件,并通过脚本控制播放。 Unity 中的动画系统基于权重,并且支持动画混合、附加动画、动画混组、分层,以及对播放的各个方面的全面控制。 有关 Unity 中动画脚本的概述,请参阅 [read this introduction](../Manual/AnimationOverview.html)。 [AnimationState](AnimationState.html) 可用于更改动画的层,修改播放速度,以及直接控制混合和混组。 [Animation](Animation.html) 也支持枚举器。对所有 AnimationStates 执行循环的方式如下所示: ``` using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { public Animation anim; void Start() { anim = GetComponent<Animation>(); foreach (AnimationState state in anim) { state.speed = 0.5F; } } } ``` 另请参阅:Unity 中动画脚本的概述:[here](../Manual/AnimationOverview.html)。 ## 变量 | [animatePhysics](Animation-animatePhysics.html) | 打开时,动画将在物理循环中执行。这仅在与运动刚体配合时才有用。 | | ---------------------------------------------------- | ----------------------------------------------------------------- | | [clip](Animation-clip.html) | 默认动画。 | | [cullingType](Animation-cullingType.html) | 控制该动画组件的剔除。 | | [isPlaying](Animation-isPlaying.html) | 目前是否正在播放动画? | | [localBounds](Animation-localBounds.html) | 本地空间中此动画组件的 AABB。 | | [playAutomatically](Animation-playAutomatically.html) | 默认动画剪辑(Animation.clip 属性)是否应在启动时自动开始播放? | | [this[string]](Animation.Index_operator.html) | 返回名称为 name 的动画状态。 | | [wrapMode](Animation-wrapMode.html) | 应如何处理超出此剪辑播放范围的时间? | ## 公共函数 | [AddClip](Animation.AddClip.html) | 将 clip 添加到名称为 newName 的动画中。 | | ------------------------------------------------ | --------------------------------------------------------------------------- | | [Blend](Animation.Blend.html) | 在后续 time 秒中将名称为 animation 的动画向 targetWeight 混合。 | | [CrossFade](Animation.CrossFade.html) | 在后续 time 秒的时间段内,使名称为 animation 的动画淡入,使其他动画淡出。 | | [CrossFadeQueued](Animation.CrossFadeQueued.html) | 使动画在上一个动画播放完成后交叉淡入淡出。 | | [GetClipCount](Animation.GetClipCount.html) | 获取当前分配给该动画的剪辑数。 | | [IsPlaying](Animation.IsPlaying.html) | 名称为 name 的动画是否正在播放? | | [Play](Animation.Play.html) | 播放没有混合的动画。 | | [PlayQueued](Animation.PlayQueued.html) | 在先前的动画播放完毕后再播放动画。 | | [RemoveClip](Animation.RemoveClip.html) | 从动画列表中移除剪辑。 | | [Rewind](Animation.Rewind.html) | 倒回名称为 name 的动画。 | | [Sample](Animation.Sample.html) | 对当前状态的动画进行采样。 | | [Stop](Animation.Stop.html) | 停止所有使用该动画启动的正在播放的动画。 | ## 继承的成员 ## 变量 | [enabled](Behaviour-enabled.html) | 启用的 Behaviour 可更新,禁用的 Behaviour 不可更新。 | | ------------------------------------------------------ | ------------------------------------------------------ | | [isActiveAndEnabled](Behaviour-isActiveAndEnabled.html) | 是否已激活并启用 Behaviour? | | [gameObject](Component-gameObject.html) | 此组件附加到的游戏对象。始终将组件附加到游戏对象。 | | [tag](Component-tag.html) | 此游戏对象的标签。 | | [transform](Component-transform.html) | 附加到此 GameObject 的 Transform。 | | [hideFlags](Object-hideFlags.html) | 该对象应该隐藏、随场景一起保存还是由用户修改? | | [name](Object-name.html) | 对象的名称。 | ## 公共函数 | [BroadcastMessage](Component.BroadcastMessage.html) | 调用此游戏对象或其任何子项中的每个 MonoBehaviour 上名为 methodName 的方法。 | | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------- | | [CompareTag](Component.CompareTag.html) | 此游戏对象是否使用 tag 进行了标记? | | [GetComponent](Component.GetComponent.html) | 如果游戏对象附加了类型为 type 的组件,则将其返回,否则返回 null。 | | [GetComponentInChildren](Component.GetComponentInChildren.html) | 使用深度首次搜索返回 GameObject 或其任何子项中类型为 type 的组件。 | | [GetComponentInParent](Component.GetComponentInParent.html) | 返回 GameObject 或其任何父项中类型为 type 的组件。 | | [GetComponents](Component.GetComponents.html) | 返回 GameObject 中类型为 type 的所有组件。 | | [GetComponentsInChildren](Component.GetComponentsInChildren.html) | 返回 GameObject 或其任何子项中类型为 type 的所有组件。 | | [GetComponentsInParent](Component.GetComponentsInParent.html) | 返回 GameObject 或其任何父项中类型为 type 的所有组件。 | | [SendMessage](Component.SendMessage.html) | 调用此游戏对象中的每个 MonoBehaviour 上名为 methodName 的方法。 | | [SendMessageUpwards](Component.SendMessageUpwards.html) | 调用此游戏对象中的每个 MonoBehaviour 上或此行为的每个父级上名为 methodName 的方法。 | | [TryGetComponent](Component.TryGetComponent.html) | 获取指定类型的组件(如果存在)。 | | [GetInstanceID](Object.GetInstanceID.html) | 返回对象的实例 ID。 | | [ToString](Object.ToString.html) | 返回对象的名称。 | ## 静态函数 | [Destroy](Object.Destroy.html) | 移除 GameObject、组件或资源。 | | ------------------------------------------------- | ------------------------------------------------ | | [DestroyImmediate](Object.DestroyImmediate.html) | 立即销毁对象 /obj/。强烈建议您改用 Destroy。 | | [DontDestroyOnLoad](Object.DontDestroyOnLoad.html) | 在加载新的 Scene 时,请勿销毁 Object。 | | [FindObjectOfType](Object.FindObjectOfType.html) | 返回第一个类型为 type 的已加载的激活对象。 | | [FindObjectsOfType](Object.FindObjectsOfType.html) | 返回所有类型为 type 的已加载的激活对象的列表。 | | [Instantiate](Object.Instantiate.html) | 克隆 original 对象并返回克隆对象。 | ## 运算符 | [bool](Object-operator_Object.html) | 该对象是否存在? | | ------------------------------------- | ------------------------------------------------ | | [operator !=](Object-operator_ne.html) | 比较两个对象是否引用不同的对象。 | | [operator ==](Object-operator_eq.html) | 比较两个对象引用,判断它们是否引用同一个对象。 |
da
2022年5月23日 22:28
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码