Lerp
Interpolates between two vertices, writing into result a new vertex a fraction t of the way from a to b.
Read time 2 minutesLast updated 12 days ago
Definition
- Type: Method
- Namespace: UnityEngine.UIElements
- Assembly: UnityEngine.UIElementsModule
Lerp(Vertex, Vertex, float, Vertex)
Interpolates between two vertices, writing into a new vertex a fraction of the way from to .
resulttabpublic static void Lerp(in Vertex a, in Vertex b, float t, out Vertex result)
Parameters
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 .
aBecause that discrete data is copied rather than blended, and must belong to the same fill (the same draw within one VisualElement) — which is always the case when resampling the triangles of a single mesh. is not clamped: values outside the 0..1 range extrapolate beyond the endpoints.
abtLerp(Vertex, Vertex, float)
Interpolates between two vertices, returning a new vertex a fraction of the way from to . Convenience overload that returns the result instead of writing to an out parameter — handy when the value is temporary.
tabpublic static Vertex Lerp(in Vertex a, in Vertex b, float t)
Parameters
Returns
Type | Description |
|---|---|
| Vertex | The interpolated vertex. |