# Lerp

> Interpolates between two vertices, writing into result a new vertex a fraction t of the way from a to b.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.UIElements](/engine/6000.6/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule

## Lerp(Vertex, Vertex, float, Vertex)

Interpolates between two vertices, writing into `result` a new vertex a fraction `t` of the way from `a` to `b`.

```csharp
public static void Lerp(in Vertex a, in Vertex b, float t, out Vertex result)
```

### Parameters

**** (\[Vertex]\(/engine/6000.6/script-reference/unityengine/uielements/vertex)): The vertex written to `result` when `t` is 0.**** (\[Vertex]\(/engine/6000.6/script-reference/unityengine/uielements/vertex)): The vertex written to `result` when `t` is 1.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The interpolation factor. 0 selects `a`, 1 selects `b`.**** (\[Vertex]\(/engine/6000.6/script-reference/unityengine/uielements/vertex)): Receives the interpolated vertex.

### Remarks

Use this when a mesh modifier adds vertices between existing ones — for example when subdividing, tessellating, or clipping geometry. The continuous vertex data (position, tint, texture coordinate, and the internal anti-aliasing data) is blended; the discrete per-vertex data that identifies the draw (clipping, element, texture, and gradient identifiers, and flags) is taken from `a`.

Because that discrete data is copied rather than blended, `a` and `b` must belong to the same fill (the same draw within one [VisualElement](/engine/6000.6/script-reference/unityengine/uielements/visualelement.md)) — which is always the case when resampling the triangles of a single mesh. `t` is not clamped: values outside the 0..1 range extrapolate beyond the endpoints.

## Lerp(Vertex, Vertex, float)

Interpolates between two vertices, returning a new vertex a fraction `t` of the way from `a` to `b`. Convenience overload that returns the result instead of writing to an out parameter — handy when the value is temporary.

```csharp
public static Vertex Lerp(in Vertex a, in Vertex b, float t)
```

### Parameters

**** (\[Vertex]\(/engine/6000.6/script-reference/unityengine/uielements/vertex)): The vertex returned when `t` is 0.**** (\[Vertex]\(/engine/6000.6/script-reference/unityengine/uielements/vertex)): The vertex returned when `t` is 1.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The interpolation factor. 0 returns `a`, 1 returns `b`.

### Returns

| Type                                                                       | Description              |
| -------------------------------------------------------------------------- | ------------------------ |
| [Vertex](/engine/6000.6/script-reference/unityengine/uielements/vertex.md) | The interpolated vertex. |
