言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

Mathf.Lerp

public static function Lerp(from: float, to: float, t: float): float;

Description

Interpolates between a and b by t. t is clamped between 0 and 1.

When t = 0 returns from. When t = 1 return to. When t = 0.5 returns the average of a and b.

	// Fades from minimum to maximum in one second

	var minimum = 10.0;
	var maximum = 20.0;

	function Update () {
		transform.position = Vector3(Mathf.Lerp(minimum, maximum, Time.time), 0, 0);
	}