用户工具

站点工具


侧边栏



Unity3D中文文档

script:unityengine:classes:animation:animation

Animation 动画

class in UnityEngine / Inherits from: Behaviour

Description 描述

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 playback.

你能指定动画剪辑到动画组件并从脚本控制播放。该动画系统是基于权重并支持动画融合、添加动画、动画混合、层并完全控制播放的各个方面。

AnimationState can be used to change the layer of an animation, modify playback speed, and for direct control over blending and mixing.

AnimationState可以用于改变动画的层、修改播放速度以及直接控制融合与混合。

Animation also supports enumerators so you can loop through all AnimationStates like this:

动画也支持枚举,所以你可以像这样在AnimationStates之间循环:

JavaScript:

var anim: Animation;
 
function Start() {
	anim = GetComponent.<Animation>();
 
	// Make all animations in this character play at half speed
	for (var state : AnimationState in anim) {
		state.speed = 0.5;
	}
}

C#:

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;
        }
    }
}

Variables 变量

animatePhysicsWhen turned on, animations will be executed in the physics loop. This is only useful in conjunction with kinematic rigidbodies.
如果打开这个选项,动画会在物理循环过程中被执行。这个选项只有在结合运动学刚体的时候才有用。
clipThe default animation.
默认的动画。
cullingTypeControls culling of this Animation component.
控制动画组件的剔除类型。
isPlayingAre we playing any animations?
有任意动画正播放?
localBoundsAABB of this Animation animation component in local space.
在本地坐标空间这个动画的动画组件的AABB。
playAutomaticallyShould the default animation clip (the Animation.clip property) automatically start playing on startup?
在启动的时候是否自动播放默认动画剪辑(Animation.clip)。
this[string]Returns the animation state named name.
返回指定名称的动画状态。
wrapModeHow should time beyond the playback range of the clip be treated?
动画剪辑播放完成之后,应该如何操作?

Public Functions 共有函数

AddClipAdds a clip to the animation with name newName.
添加一个指定名称的动画剪辑。
BlendBlends the animation named animation towards targetWeight over the next time seconds.
在接下来的几秒内混合命名为animation的动画到targetWeight。
CrossFadeFades the animation with name animation in over a period of time seconds and fades other animations out.
在一定时间内淡入名称为name的动画并且淡出其他动画。
CrossFadeQueuedCross fades an animation after previous animations has finished playing.
在前一个动画播放完成之后淡入淡出下一个动画。
GetClipCountGet the number of clips currently assigned to this animation.
取得该动画的动画剪辑数量。
IsPlayingIs the animation named name playing?
名为name的动画正在播放吗?
PlayPlays an animation without any blending.
不带有任何混合的播放动画。
PlayQueuedPlays an animation after previous animations has finished playing.
在前一个动画播放完成之后直接播放下一个动画。
RemoveClipRemove clip from the animation list.
从动画列表移除剪辑。
RewindRewinds the animation named name.
倒回名称为name的动画。
SampleSamples animations at the current state.
在当前状态对动画进行采样。
StopStops all playing animations that were started with this Animation.
停止所有当前Animation正在播放的动画。
script/unityengine/classes/animation/animation.txt · 最后更改: 2016/08/02 05:33 (外部编辑)