找回密碼
 注冊帳號

掃一掃,訪問微社區

animationcurve.keys 所有鍵

2014-12-31 03:58| 發布者: 楊炎| 查看: 1824| 評論: 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);

}

相關閱讀

文章點評
相關文章
女校游泳队彩金