Unity3D圣典3.3版本-中文版
文集大纲加载中……
本文档使用 MrDoc 发布
-
+
首页
Animation 动画
# Animation 动画 Inherits from [Behaviour](../Behaviour/Behaviour.html),IEnumerable The animation component is used to play back animations. animation 组件用于播放动画。 You can assign animation clips to the animation component and control playback from your script. The animation system in Unity is weight based and supports: Animation Blending, Additive animations, Animation Mixing, Layers and full control over all aspects of animation playback. 你可以给动画组件添加动画帧并且在你的脚本里面控制动画的播放。Unity 里面的动画系统基于重量并且支持动画混合(Blending),添加动画,动画混合(Mixing),标签和所有动画播放比率的全权控制。 To play a simple animation use [Animation.Play](Animation.Play.html) To cross-fade between animations use [Animation.CrossFade](Animation.CrossFade.html) To change how animations wrap (Loop, Once, PingPong) change the [WrapMode](../Enumerations/WrapMode/WrapMode.html) of the respective AnimationClips in their import settings, or [use AnimationState.wrapMode](../AnimationState/AnimationState.wrapMode.html) to change it at runtime. [AnimationState](../AnimationState/AnimationState.html) can be used to change the layer of an animation, modify playback speed, and for direct control over blending and mixing. 如果想播放一个简单的动画,可以使用 Animation.Play; 如果想在动画之间交叉淡入,可以使用 Animation.CrossFade; 如果想改变动画模式(循环,一次,乒乓),可以改变动画导入设置里面的动画帧的 WrapMode,或者在运行时改变 AnimationState.wrapMode 的值; [AnimationState](../AnimationState/AnimationState.html) 可以用于改变动画的层,修改播放速度,并且直接控制混合与合成。 Animation also supports enumerators so you can loop through all AnimationStates like this: 动画也支持枚举,所以你可以像这样在 AnimationStates 之间循环: * [C#](#) * [JavaScript](#) ``` using UnityEngine; using System.Collections; public class example : MonoBehaviour { public void Awake() { foreach (AnimationState state in animation) { state.speed = 0.5F; } } } ``` ``` // Make all animations in this character play at half speed // 使这个角色的所有动画的播放速度降为一半 for (var state : AnimationState in animation) { state.speed = 0.5; } ``` ### Variables**变量** * [clip](Animation.clip.html) The default animation. 默认的动画剪辑。 * [playAutomatically](Animation.playAutomatically.html) Should the default animation clip (Animation.clip) automatically start playing on startup. 是否在开始的时候自动播放默认的动画([Animation.clip](Animation.clip.html))。 * [wrapMode](Animation.wrapMode.html) How should time beyond the playback range of the clip be treated? 动画剪辑播放完成之后,应该如何操作? * [isPlaying](Animation.isPlaying.html) Are we playing any animations? 是否在播放任何动画? * [this [string name] ](Animation.Index_operator.html) Returns the animation state named name. 返回名称为 name 的动画状态。 * [animatePhysics](Animation.animatePhysics.html) When turned on, animations will be executed in the physics loop. This is only useful in conjunction with kinematic rigidbodies. 如果打开这个选项,动画会在物理循环过程中被执行。这个选项只有在结合运动学刚体的时候才有用。 * [animateOnlyIfVisible](Animation.animateOnlyIfVisible.html) When turned on, Unity might stop animating if it thinks that the results of the animation won't be visible to the user. 如果打开这个选项,Unity 可能在它认为用户不会看到当前动画的时候停止播放。 ### Functions**函数** * [Stop](Animation.Stop.html) Stops all playing animations that were started with this Animation. 停止所有当前 Animation 正在播放的动画。 * [Rewind](Animation.Rewind.html) Rewinds the animation named name. 倒播名称为 name 的动画。 * [Sample](Animation.Sample.html) Samples animations at the current state. 在当前状态对动画进行采样。 * [IsPlaying](Animation.IsPlaying_.html) Is the animation named name playing? 名为 name 的动画正在播放吗? * [Play](Animation.Play.html) Plays animation without any blending. 没有任何混合的播放动画。 * [CrossFade](Animation.CrossFade.html) Fades the animation with name animation in over a period of time seconds and fades other animations out. 在一定时间内淡入名称为 name 的动画并且淡出其他动画。 * [Blend](Animation.Blend.html) Blends the animation named animation towards targetWeight over the next time seconds. 在接下来的几秒内混合名称为 name 的动画直到 targetWeight。 * [CrossFadeQueued](Animation.CrossFadeQueued.html) Cross fades an animation after previous animations has finished playing. 在前一个动画播放完成之后淡入淡出下一个动画。 * [PlayQueued](Animation.PlayQueued.html) Plays an animation after previous animations has finished playing. 在前一个动画播放完成之后直接播放下一个动画。 * [AddClip](Animation.AddClip.html) Adds a clip to the animation with name newName. 给动画添加一个名称为 newName 的动画剪辑。 * [RemoveClip](Animation.RemoveClip.html) Remove clip from the animation list. 从动画列表移除剪辑。 * [GetClipCount](Animation.GetClipCount.html) Get the number of clips currently assigned to this animation 取得当前动画的动画剪辑数量。 * [SyncLayer](Animation.SyncLayer.html) Synchronizes playback speed of all animations in the layer. 同步某层的动画的播放速度。 ## Inherited members**继承成员** ### Inherited Variables**继承变量** * [enabled](../Behaviour/Behaviour.enabled.html) Enabled Behaviours are Updated, disabled Behaviours are not. 启用行为被更新,禁用行为不更新。 * [transform](../Component/Component.transform.html) The [Transform](../Transform/Transform.html) attached to this [GameObject](../GameObject/GameObject.html) (null if there is none attached). [Transform](../Transform/Transform.html) 附加到 [GameObject](../GameObject/GameObject.html)(游戏物体)(如无附加则为空)。 * [rigidbody](../Component/Component.rigidbody.html) The [Rigidbody](../Rigidbod/Rigidbody.html) attached to this [GameObject](../GameObject/GameObject.html) (null if there is none attached). [Rigidbody](../Rigidbod/Rigidbody.html)[](../Transform/Transform.html)附加到 [GameObject](../GameObject/GameObject.html)(游戏物体)(如无附加则为空)。 * [camera](../Component/Component.camera.html) The [Camera](../Camera/Camera.html) attached to this [GameObject](../GameObject/GameObject.html) (null if there is none attached). [Camera](../Camera/Camera.html)[](../Rigidbod/Rigidbody.html)[](../Transform/Transform.html)附加到 [GameObject](../GameObject/GameObject.html)(游戏物体)(如无附加则为空)。 * [light](../Component/Component.light.html) The [Light](../Light/Light.html) attached to this [GameObject](../GameObject/GameObject.html) (null if there is none attached). [Light](../Light/Light.html)[](../Camera/Camera.html)[](../Rigidbod/Rigidbody.html)[](../Transform/Transform.html)附加到 [GameObject](../GameObject/GameObject.html)(游戏物体)(如无附加则为空)。 * [animation](../Component/Component.animation.html) The [Animation](Animation.html) attached to this [GameObject](../GameObject/GameObject.html) (null if there is none attached). [Animation](Animation.html)[](../Light/Light.html)[](../Camera/Camera.html)[](../Rigidbod/Rigidbody.html)[](../Transform/Transform.html)附加到 [GameObject](../GameObject/GameObject.html)(游戏物体)(如无附加则为空)。 * [constantForce](../Component/Component.constantForce.html) The [ConstantForce](../ConstantForce/ConstantForce.html) attached to this [GameObject](../GameObject/GameObject.html) (null if there is none attached). [ConstantForce](../ConstantForce/ConstantForce.html)[](Animation.html)[](../Light/Light.html)[](../Camera/Camera.html)[](../Rigidbod/Rigidbody.html)[](../Transform/Transform.html)附加到 [GameObject](../GameObject/GameObject.html)(游戏物体)(如无附加则为空)。 * [renderer](../Component/Component.renderer.html) The [Renderer](../Renderer/Renderer.html) attached to this [GameObject](../GameObject/GameObject.html) (null if there is none attached). [Renderer](../Renderer/Renderer.html)[](../ConstantForce/ConstantForce.html)[](Animation.html)[](../Light/Light.html)[](../Camera/Camera.html)[](../Rigidbod/Rigidbody.html)[](../Transform/Transform.html)附加到 [GameObject](../GameObject/GameObject.html)(游戏物体)(如无附加则为空)。 * [audio](../Component/Component.audio.html) The [AudioSource](../AudioSource/AudioSource.html) attached to this [GameObject](../GameObject/GameObject.html) (null if there is none attached). [AudioSource](../AudioSource/AudioSource.html)[](../Renderer/Renderer.html)[](../ConstantForce/ConstantForce.html)[](Animation.html)[](../Light/Light.html)[](../Camera/Camera.html)[](../Rigidbod/Rigidbody.html)[](../Transform/Transform.html)附加到 [GameObject](../GameObject/GameObject.html)(游戏物体)(如无附加则为空)。 * [guiText](../Component/Component.guiText.html) The [GUIText](../GUIText/GUIText.html) attached to this [GameObject](../GameObject/GameObject.html) (null if there is none attached). [GUIText](../GUIText/GUIText.html)[](../AudioSource/AudioSource.html)[](../Renderer/Renderer.html)[](../ConstantForce/ConstantForce.html)[](Animation.html)[](../Light/Light.html)[](../Camera/Camera.html)[](../Rigidbod/Rigidbody.html)[](../Transform/Transform.html)附加到 [GameObject](../GameObject/GameObject.html)(游戏物体)(如无附加则为空)。 * [networkView](../Component/Component.networkView.html) The [NetworkView](../NetworkView/NetworkView.html) attached to this [GameObject](../GameObject/GameObject.html) (Read Only). (null if there is none attached) [NetworkView](../NetworkView/NetworkView.html)[](../GUIText/GUIText.html)[](../AudioSource/AudioSource.html)[](../Renderer/Renderer.html)[](../ConstantForce/ConstantForce.html)[](Animation.html)[](../Light/Light.html)[](../Camera/Camera.html)[](../Rigidbod/Rigidbody.html)[](../Transform/Transform.html)附加到 [GameObject](../GameObject/GameObject.html)(游戏物体)(只读)(如无附加则为空)。 * [guiTexture](../Component/Component.guiTexture.html) The [GUITexture](../GUITexture/GUITexture.html) attached to this [GameObject](../GameObject/GameObject.html) (Read Only). (null if there is none attached) [GUITexture](../GUITexture/GUITexture.html) 附加到 [GameObject](../GameObject/GameObject.html)(游戏物体)(只读)(如无附加则为空)。 * [collider](../Component/Component.collider.html) The [Collider](../Collider/Collider.html) attached to this [GameObject](../GameObject/GameObject.html) (null if there is none attached). [Collider](../Collider/Collider.html) 附加到 [GameObject](../GameObject/GameObject.html)(游戏物体)(如无附加则为空)。 * [hingeJoint](../Component/Component.hingeJoint.html) The [HingeJoint](../HingeJoint/HingeJoint.html) attached to this [GameObject](../GameObject/GameObject.html) (null if there is none attached). [HingeJoint](../HingeJoint/HingeJoint.html) 附加到 [GameObject](../GameObject/GameObject.html)(游戏物体)(如无附加则为空)。 * [particleEmitter](../Component/Component.particleEmitter.html) The [ParticleEmitter](../ParticleEmitter/ParticleEmitter.html) attached to this [GameObject](../GameObject/GameObject.html) (null if there is none attached). [ParticleEmitter](../ParticleEmitter/ParticleEmitter.html) 附加到 [GameObject](../GameObject/GameObject.html)(游戏物体)(如无附加则为空)。 * [gameObject](../Component/Component.gameObject.html) The game object this component is attached to. A component is always attached to a game object. 组件附加的游戏物体。一个组件总是被附加到一个游戏物体。 * [tag](../Component/Component.tag.html) The tag of this game object. 游戏物体的标签。 * [name](../Object/Object.name.html) The name of the object. //物体的名字 * [hideFlags](../Object/Object.hideFlags.html) Should the object be hidden, saved with the scene or modifiable by the user? 物体是否被隐藏、保存在场景中或被用户修改? ### Inherited Functions**继承函数** * [GetComponent](../Component/Component.GetComponent.html) Returns the component of Type type if the game object has one attached, null if it doesn't. 如果游戏物体有一个附加,则返回 Type 类型的组件,如果没有则为 null。 * [GetComponent.<T>](../Component/Component.GetComponent.ltTgt.html) * [GetComponent](../Component/Component.GetComponent.html) Returns the component with name type if the game object has one attached, null if it doesn't. 如果游戏物体有一个附加,则返回名字类型组件,如果没有则为 null。 * [GetComponentInChildren](../Component/Component.GetComponentInChildren.html) Returns the component of Type type in the [GameObject](../GameObject/GameObject.html) or any of its children using depth first search. 返回 Type 类型组件,在 [GameObject](../GameObject/GameObject.html) 或它的任何子物体使用深度优先搜索,仅返回激活的组件。 * [GetComponentInChildren.<T>](../Component/Component.GetComponentInChildren.ltTgt.html) * [GetComponentsInChildren](../Component/Component.GetComponentsInChildren.html) Returns all components of Type type in the [GameObject](../GameObject/GameObject.html) or any of its children. 在 [GameObject](../GameObject/GameObject.html) 或任何它的子物体,返回全部 Type 类型组件 * [GetComponentsInChildren.<T> ](../Component/Component.GetComponentsInChildren.ltTgt.html) * [GetComponents](../Component/Component.GetComponents.html) Returns all components of Type type in the [GameObject](../GameObject/GameObject.html). 在游戏物体返回全部 Type 类型组件。 * [GetComponents.<T> ](../Component/Component.GetComponents.ltTgt.html) * [CompareTag](../Component/Component.CompareTag.html) Is this game object tagged tag? 游戏物体有被标记标签么? * [SendMessageUpwards](../Component/Component.SendMessageUpwards.html) Calls the method named methodName on every [MonoBehaviour](../MonoBehaviour/MonoBehaviour.html) in this game object and on every ancestor of the behaviour 在游戏物体每一个 [MonoBehaviour](../MonoBehaviour/MonoBehaviour.html) 和每一个 behaviour 的祖先上调用名为 methodName 的方法。 * [SendMessage](../Component/Component.SendMessage.html) Calls the method named methodName on every [MonoBehaviour](../MonoBehaviour/MonoBehaviour.html) in this game object. 在游戏物体每一个 [MonoBehaviour](../MonoBehaviour/MonoBehaviour.html) 上调用名为 methodName 的方法。 * [BroadcastMessage](../Component/Component.BroadcastMessage.html) Calls the method named methodName on every [MonoBehaviour](../MonoBehaviour/MonoBehaviour.html) in this game object or any of its children. 在游戏物体每一个 [MonoBehaviour](../MonoBehaviour/MonoBehaviour.html) 和它的全部子物体上调用名为 methodName 的方法。 * [GetInstanceID](../Object/Object.GetInstanceID.html) Returns the instance id of the object. 返回物体的实例 ID * [ToString](../Object/Object.ToString.html) Returns the name of the game object. 返回游戏物体的名称。 ### Inherited Class Functions**继承类函数** * [operator bool](../Object/Object.operator_bool.html) Does the object exist? 物体是否存在? * [Instantiate](../Object/Object.Instantiate.html) Clones the object original and returns the clone. 克隆原始物体,并返回克隆的物体 * [Instantiate.<T>](../Object/Object.Instantiate.ltTgt.html) * [Destroy](../Object/Object.Destroy.html) Removes a gameobject, component or asset. 删除一个游戏物体、组件或资源 * [DestroyImmediate](../Object/Object.DestroyImmediate.html) Destroys the object obj immediately. It is strongly recommended to use Destroy instead. 立即销毁物体 obj,强烈建议使用 Destroy 代替。 * [FindObjectsOfType](../Object/Object.FindObjectsOfType.html) Returns a list of all active loaded objects of Type type. 返回 Type 类型的所有激活的加载的物体列表 * [FindObjectOfType](../Object/Object.FindObjectOfType.html) Returns the first active loaded object of Type type. 返回 Type 类型第一个激活的加载的物体。 * [operator ==](../Object/Object.operator_eq.html) Compares if two objects refer to the same 比较如果两个物体相同 * [operator !=](../Object/Object.operator_ne.html) Compares if two objects refer to a different object 比较如果两个物体不同 * [DontDestroyOnLoad](../Object/Object.DontDestroyOnLoad.html) Makes the object target not be destroyed automatically when loading a new scene. 加载新场景的时候使目标物体不被自动销毁。
da
2022年5月13日 22:04
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码