找回密码
 注册帐号

扫一扫,访问微社区

animationcurve.keys 所有键

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

摘要: animationcurve.keys所有键varkeys: keyframedescription描述all keys defined in the animation curve.在动画曲线中定义的所有键.this lets you clear, add or remove any keys from the array. if keys are not so ...

animationcurve.keys所有键

varkeys: keyframe[]

description描述

all keys defined in the animation curve.

动画曲线中定义的所有键.

this lets you clear, add or remove any keys from the array. if keys are not sorted by time, they will be automatically sorted on assignment.

这让你从数组中清理,添加,移除任何键.如果键没有按照时间排序,他们会在赋值的时候自动排序.

note that the array is "by value", i.e. getting keys returns a copy of all keys and setting keys copies them into the curve.

注意:数组是通过值排序.即是:获取键返回一个所有键的副本并设置键的副本到曲线.

see also:keyframestruct,addkey,removekeyfunctions.

c#

javascript

using unityengine;

using system.collections;

public class example :monobehaviour{

private animationcurve anim;

private keyframe[] ks;

void start() {

ks = new keyframe[50];

int i = 0;

while (i < ks.length) {

ks[i] = new keyframe(i, i * i);

i++;

}

anim = new animationcurve(ks);

}

void update() {

transform.position = newvector3(time.time, anim.evaluate(time.time), 0);

}

}

// make a gameobject follow a cuadratic function

// 使一个游戏对象跟随一个cuadratic函数

// over the x and y axis.

// 在x,y轴

private var anim : animationcurve;

private var ks : keyframe [];

function start() {

ks = new keyframe [50];

for(var i = 0; i < ks.length ; i++){

ks[i] = keyframe (i,i*i);

}

anim = new animationcurve(ks);

}

function update() {

transform.position =vector3( time.time ,anim.evaluate( time.time ),0);

}

相关阅读

文章点评
相关文章