AnimationCurve.AnimationCurve 动画曲线

static function AnimationCurve (params keys : Keyframe[]) : AnimationCurve

Description描述

Creates an animation curve from arbitrary number of keyframes.

根据任意数量的关键帧创建一个动画曲线.

This creates a curve from variable number of Keyframe parameters. If you want to create curve from an array of keyframes, create an empty curve and assign keys property.

该函数根据关键帧参数创建曲线.如果你想从一个关键帧数组中创建一个曲线.创建一个曲线并赋值键属性.

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public AnimationCurve curve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 1));
	void Update() {
		transform.position.x = Time.time;
		transform.position.y = curve.Evaluate(Time.time);
	}
}
// An ease in, ease out animation curve (tangents are all flat)

// 一个渐入渐出的动画曲线(切线都是平直的)
var curve = new AnimationCurve( Keyframe (0, 0), Keyframe (1, 1));

function Update () {
   transform.position.x = Time.time ;
   transform.position.y = curve.Evaluate( Time.time );
}

• static function AnimationCurve () : AnimationCurve

Description描述

Creates an empty animation curve

创建一个空的动画曲线.

最后修改:2010年12月7日 Tuesday 18:42

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。