13 public static void SetLerp(
this Camera
self, Camera a, Camera b,
float t)
15 Color backgroundColor = Color.Lerp(a.backgroundColor,b.backgroundColor,t);
16 float fieldOfView = Mathf.Lerp(a.fieldOfView, b.fieldOfView, t);
17 float farClipPlane = Mathf.Lerp(a.farClipPlane, b.farClipPlane, t);
18 float nearClipPlane = Mathf.Lerp(a.nearClipPlane, b.nearClipPlane, t);
19 Rect rect =
new Rect(Vector2.Lerp(a.rect.position, b.rect.position, t), Vector2.Lerp(a.rect.size, b.rect.size, t));
21 float depth = Mathf.Lerp(a.depth, b.depth, t);
23 self.SetProperties(backgroundColor, fieldOfView, farClipPlane, nearClipPlane, rect, depth);
35 public static void SetProperties(
this Camera cam, Color backgroundColor,
float fieldOfView,
float farClipPlane,
float nearClipPlane, Rect rect,
float depth)
37 cam.backgroundColor = backgroundColor;
38 cam.fieldOfView = fieldOfView;
39 cam.farClipPlane = farClipPlane;
40 cam.nearClipPlane = nearClipPlane;
Extensions for the Camera component
static void SetLerp(this Camera self, Camera a, Camera b, float t)
Linearly interpolates between two cameras.
static void SetProperties(this Camera cam, Color backgroundColor, float fieldOfView, float farClipPlane, float nearClipPlane, Rect rect, float depth)
Sets the camera parameters that can be linearly interpolated.