查看: 3750|回复: 5
打印 上一主题 下一主题

[其他] 重要的类 - Animation 动画

[复制链接]

2722

主题

42

听众

3万

积分

资深设计师

Rank: 7Rank: 7Rank: 7

纳金币
38266
精华
111

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

跳转到指定楼层
楼主
发表于 2014-6-24 00:25:19 |只看该作者 |倒序浏览

Inherits from Behaviour,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的动画系统基于权重并且支持动画融合,叠加动画,动画混合,标签和完全控制动画播放的各个方面。
To play a simple animation use Animation.Play

To cross-fade between animations use Animation.CrossFade

To change how animations wrap (Loop, Once, PingPong) change the WrapMode of the respective AnimationClips in their import settings, or use AnimationState.wrapMode to change it at***ntime.

AnimationState 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可以用于改变动画的层,修改播放速度,并且直接控制融合与混合。
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
    The default animation.

    默认的动画剪辑。
   
   
    playAutomatically
    Should the default animation clip (Animation.clip) automatically start playing on startup.

    是否在开始的时候自动播放默认的动画(Animation.clip)。
   
   
    wrapMode
    How should time beyond the playback range of the clip be treated?

    动画剪辑播放完成之后,应该如何操作?
   
   
    isPlaying
    Are we playing any animations?

    是否在播放任何动画?
   
   
    this [string name]
    Returns the animation state named name.

    返回名称为name的动画状态。
   
   
    animatePhysics
    When turned on, animations will be***cuted in the physics loop. This is only useful in conjunction with kinematic rigidbodies.

    如果打开这个选项,动画会在物理循环过程中被执行。这个选项只有在结合运动学刚体的时候才有用。
   
   
    animateOnlyIfVisible
    When turned on, Unity might stop animating if it thinks that the results of the animation won't be visible to the user.

    如果打开这个选项,Unity可能在它认为用户不会看到当前动画的时候停止播放。
   
   
    cullingType
    Controls culling of this Animation component.

    控制动画组件的消隐。
   
   
    localBounds
    AABB of this Animation animation component in local space.

    在本地坐标空间这个动画的动画组件的AABB。
   

Functions函数

   
    Stop
    Stops all playing animations that were started with this Animation.

    停止所有当前Animation正在播放的动画。
   
   
    Rewind
    Rewinds the animation named name.

    倒播名称为name的动画。
   
   
    Sample
    Samples animations at the current state.

    在当前状态对动画进行采样。
   
   
    IsPlaying
    Is the animation named name playing?

    名为name的动画正在播放吗?
   
   
    Play
    Plays animation without any blending.

    没有任何混合的播放动画。
   
   
    CrossFade
    Fades the animation with name animation in over a period of time seconds and fades other animations out.

    在一定时间内淡入名称为name的动画并且淡出其他动画。
   
   
    Blend
    Blends the animation named animation towards targetWeight over the next time seconds.

    在接下来的几秒内混合名称为name的动画直到targetWeight。
   
   
    CrossFadeQueued
    Cross fades an animation after previous animations has finished playing.

    在前一个动画播放完成之后淡入淡出下一个动画。
   
   
    PlayQueued
    Plays an animation after previous animations has finished playing.

    在前一个动画播放完成之后直接播放下一个动画。
   
   
    AddClip
    Adds a clip to the animation with name newName.

    给动画添加一个名称为newName的动画剪辑。
   
   
    RemoveClip
    Remove clip from the animation list.

    从动画列表移除剪辑。
   
   
    GetClipCount
    Get the number of clips currently assigned to this animation

    取得当前动画的动画剪辑数量。
   
   
    SyncLayer
    Synchronizes playback speed of all animations in the layer.

    同步某层的动画的播放速度。
   

Inherited members继承成员
Inherited Variables继承变量

   
    enabled
    Enabled Behaviours are Updated, disabled Behaviours are not.

    启用行为被更新,禁用行为不更新。
   


   
    transform
    The Transform attached to this GameObject (null if there is none attached).

    Transform附加到GameObject(游戏物体)(如无附加则为空)。
   
   
    rigidbody
    The Rigidbody attached to this GameObject (null if there is none attached).

    Rigidbody附加到GameObject(游戏物体)(如无附加则为空)。
   
   
    camera
    The Camera attached to this GameObject (null if there is none attached).

    Camera附加到GameObject(游戏物体)(如无附加则为空)。
   
   
    light
    The Light attached to this GameObject (null if there is none attached).

    Light附加到GameObject(游戏物体)(如无附加则为空)。
   
   
    animation
    The Animation attached to this GameObject (null if there is none attached).

    Animation附加到GameObject(游戏物体)(如无附加则为空)。
   
   
    constantForce
    The ConstantForce attached to this GameObject (null if there is none attached).

    ConstantForce附加到GameObject(游戏物体)(如无附加则为空)。
   
   
    renderer
    The Renderer attached to this GameObject (null if there is none attached).

    Renderer附加到GameObject(游戏物体)(如无附加则为空)。
   
   
    audio
    The AudioSource attached to this GameObject (null if there is none attached).

    AudioSource附加到GameObject(游戏物体)(如无附加则为空)。
   
   
    guiText
    The GUIText attached to this GameObject (null if there is none attached).

    GUIText附加到GameObject(游戏物体)(如无附加则为空)。
   
   
    networkView
    The NetworkView attached to this GameObject (Read Only). (null if there is none attached)

    NetworkView附加到GameObject(游戏物体)(只读)(如无附加则为空)。
   
   
    guiTexture
    The GUITexture attached to this GameObject (Read Only). (null if there is none attached)

    GUITexture附加到GameObject(游戏物体)(只读)(如无附加则为空)。
   
   
    collider
    The Collider attached to this GameObject (null if there is none attached).

    Collider附加到GameObject(游戏物体)(如无附加则为空)。
   
   
    hingeJoint
    The HingeJoint attached to this GameObject (null if there is none attached).

    HingeJoint附加到GameObject(游戏物体)(如无附加则为空)。
   
   
    particleEmitter
    The ParticleEmitter attached to this GameObject (null if there is none attached).

    ParticleEmitter附加到GameObject(游戏物体)(如无附加则为空)。
   
   
    gameObject
    The game object this component is attached to. A component is always attached to a game object.

    组件附加的游戏物体。一个组件总是被附加到一个游戏物体。
   
   
    tag
    The tag of this game object.

    游戏物体的标签。
   


   
    name
    The name of the object. //物体的名字
   
   
    hideFlags
    Should the object be hidden, saved with the scene or modifiable by the user?

    物体是否被隐藏、保存在场景中或被用户修改?
   

Inherited Functions继承函数

   
    GetComponent
    Returns the component of Type type if the game object has one attached, null if it doesn't.

    如果游戏物体有一个附加,则返回Type类型的组件,如果没有则为null。
   
   
    GetComponent.<T>
     
   
   
    GetComponent
    Returns the component with name type if the game object has one attached, null if it doesn't.

    如果游戏物体有一个附加,则返回名字类型组件,如果没有则为null。
   
   
    GetComponentInChildren
    Returns the component of Type type in the GameObject or any of its children using depth first search.

    返回Type类型组件,在GameObject或它的任何子物体使用深度优先搜索,仅返回激活的组件。
   
   
    GetComponentInChildren.<T>
     
   
   
    GetComponentsInChildren
    Returns all components of Type type in the GameObject or any of its children.

    在GameObject或任何它的子物体,返回全部Type类型组件
   
   
    GetComponentsInChildren.<T>
     
   
   
    GetComponents
    Returns all components of Type type in the GameObject.

    在游戏物体返回全部Type类型组件。
   
   
    GetComponents.<T>
     
   
   
    CompareTag
    Is this game object tagged tag?

    游戏物体有被标记标签么?
   
   
    SendMessageUpwards
    Calls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour

    在游戏物体每一个MonoBehaviour和每一个behaviour的祖先上调用名为methodName的方法。
   
   
    SendMessage
    Calls the method named methodName on every MonoBehaviour in this game object.

    在游戏物体每一个MonoBehaviour上调用名为methodName的方法。
   
   
    BroadcastMessage
    Calls the method named methodName on every MonoBehaviour in this game object or any of its children.

    在游戏物体每一个MonoBehaviour和它的全部子物体上调用名为methodName的方法。
   


   
    GetInstanceID
    Returns the instance id of the object.

    返回物体的实例ID
   
   
    ToString
    Returns the name of the game object.

    返回游戏物体的名称。
   

Inherited Class Functions继承类函数

   
    operator bool
    Does the object exist?

    物体是否存在?
   
   
    Instantiate
    Clones the object original and returns the clone.

    克隆原始物体,并返回克隆的物体
   
   
    Instantiate.<T>
     
   
   
    Destroy
    Removes a gameobject, component or asset.

    删除一个游戏物体、组件或资源
   
   
    DestroyImmediate
    Destroys the object obj immediately. It is strongly recommended to use Destroy instead.

    立即销毁物体obj,强烈建议使用Destroy代替。
   
   
    FindObjectsOfType
    Returns a list of all active loaded objects of Type type.

    返回Type类型的所有激活的加载的物体列表
   
   
    FindObjectOfType
    Returns the first active loaded object of Type type.

    返回Type类型第一个激活的加载的物体。
   
   
    operator ==
    Compares if two objects refer to the same

    比较如果两个物体相同
   
   
    operator !=
    Compares if two objects refer to a different object

    比较如果两个物体不同
   
   
    DontDestroyOnLoad
    Makes the object target not be destroyed automatically when loading a new scene.

    加载新场景的时候使目标物体不被自动销毁。
分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

hyui    

1

主题

2

听众

6671

积分

高级设计师

Rank: 6Rank: 6

纳金币
2715
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

沙发
发表于 2014-6-24 01:53:30 |只看该作者
Good article!
回复

使用道具 举报

wucnj    

1

主题

1

听众

3160

积分

中级设计师

Rank: 5Rank: 5

纳金币
1065
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

板凳
发表于 2014-6-25 09:40:31 |只看该作者
感谢分享!!!
回复

使用道具 举报

0

主题

1

听众

860

积分

初级设计师

Rank: 3Rank: 3

纳金币
0
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

地板
发表于 2014-6-25 10:06:46 |只看该作者
呵呵
,狂发教程啊
回复

使用道具 举报

3

主题

2

听众

1154

积分

助理设计师

Rank: 4

纳金币
31
精华
0
5#
发表于 2014-6-25 15:16:02 |只看该作者
狂发教程啊
回复

使用道具 举报

0

主题

1

听众

1082

积分

助理设计师

Rank: 4

纳金币
93
精华
0
6#
发表于 2014-8-15 18:11:38 |只看该作者
挺厉害的。。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

关闭

站长推荐上一条 /1 下一条

手机版|纳金网 ( 闽ICP备08008928号

GMT+8, 2024-5-1 18:17 , Processed in 2.044323 second(s), 32 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部