找回密码
 注册帐号

扫一扫,访问微社区

animation 动画

2014-12-31 01:50| 发布者: 杨炎| 查看: 2032| 评论: 0|原作者: 蛮牛|来自: unity3d脚本manual

摘要: animation 动画inherits frombehaviour,ienumerablethe animation component is used to play back animations.animation组件用于播放动画。you can assign animation clips to the animation component and control ...

animation 动画

inherits frombehaviour,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 useanimation.play

to cross-fade between animations useanimation.crossfade

to change how animations wrap (loop, once, pingpong) change thewrapmodeof the respective animationclips in their import settings, oruse animationstate.wrapmodeto change it at runtime.

animationstatecan 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 (animationstatestate in animation) {

state.speed = 0.5f;

}

}

}

// make all animations in this character play at half speed

// 使这个角色的所有动画的播放速度降为一半

for (var state :animationstatein 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 executed 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

thetransformattached to thisgameobject(null if there is none attached).

transform附加到gameobject(游戏物体)(如无附加则为空)。

rigidbody

therigidbodyattached to thisgameobject(null if there is none attached).

rigidbody附加到gameobject(游戏物体)(如无附加则为空)。

camera

thecameraattached to thisgameobject(null if there is none attached).

camera附加到gameobject(游戏物体)(如无附加则为空)。

light

thelightattached to thisgameobject(null if there is none attached).

light附加到gameobject(游戏物体)(如无附加则为空)。

animation

theanimationattached to thisgameobject(null if there is none attached).

animation附加到gameobject(游戏物体)(如无附加则为空)。

constantforce

theconstantforceattached to thisgameobject(null if there is none attached).

constantforce附加到gameobject(游戏物体)(如无附加则为空)。

renderer

therendererattached to thisgameobject(null if there is none attached).

renderer附加到gameobject(游戏物体)(如无附加则为空)。

audio

theaudiosourceattached to thisgameobject(null if there is none attached).

audiosource附加到gameobject(游戏物体)(如无附加则为空)。

guitext

theguitextattached to thisgameobject(null if there is none attached).

guitext附加到gameobject(游戏物体)(如无附加则为空)。

networkview

thenetworkviewattached to thisgameobject(read only). (null if there is none attached)

networkview附加到gameobject(游戏物体)(只读)(如无附加则为空)。

guitexture

theguitextureattached to thisgameobject(read only). (null if there is none attached)

guitexture附加到gameobject(游戏物体)(只读)(如无附加则为空)。

collider

thecolliderattached to thisgameobject(null if there is none attached).

collider附加到gameobject(游戏物体)(如无附加则为空)。

hingejoint

thehingejointattached to thisgameobject(null if there is none attached).

hingejoint附加到gameobject(游戏物体)(如无附加则为空)。

particleemitter

theparticleemitterattached to thisgameobject(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?

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

文章点评