Version: 2022.3
言語: 日本語
public static Color Lerp (Color a, Color b, float t);

パラメーター

a Color a.
b Color b.
t Float for combining a and b.

説明

tab 間の色を線形補間します。

t は 0 から 1 の間で固定されます。t が 0 のときは a、t が 1 のときは b を返します。

The code sample sets the color of a GameObject's material to a value between white and black, based on the amount of time that has elapsed.

using UnityEngine;

public class ColorLerp : MonoBehaviour { Color lerpedColor = Color.white; Renderer renderer;

void Start() { renderer = GetComponent<Renderer>(); }

void Update() { lerpedColor = Color.Lerp(Color.white, Color.black, Mathf.PingPong(Time.time, 1)); renderer.material.color = lerpedColor; } }

関連項目: LerpUnclamped.