Version: 5.3 (switch to 5.4b)
IdiomaEnglish
  • C#
  • JS

Idioma de script

Selecciona tu lenguaje de programación favorito. Todos los fragmentos de código serán mostrados en este lenguaje.

Mathf.Lerp

Cambiar al Manual
public static float Lerp(float a, float b, float t);

Parámetros

Descripción

Linearly interpolates between a and b by t.

The parameter t is clamped to the range [0, 1].

When t = 0 returns a.
When t = 1 return b.
Cuando t = 0.5 retorna el promedio entre a y b.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public float minimum = 10.0F; public float maximum = 20.0F; void Update() { transform.position = new Vector3(Mathf.Lerp(minimum, maximum, Time.time), 0, 0); } }

See Also: LerpUnclamped, LerpAngle.