using UnityEngine; namespace LitMotion.Extensions { /// /// Provides binding extension methods for Camera /// public static class LitMotionCameraExtensions { /// /// Create a motion data and bind it to Camera.aspect /// /// The type of special parameters given to the motion data /// The type of adapter that support value animation /// This builder /// /// Handle of the created motion data. public static MotionHandle BindToAspect(this MotionBuilder builder, Camera camera) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(camera); return builder.Bind(camera, static (x, camera) => { camera.aspect = x; }); } /// /// Create a motion data and bind it to Camera.nearClipPlane /// /// The type of special parameters given to the motion data /// The type of adapter that support value animation /// This builder /// /// Handle of the created motion data. public static MotionHandle BindToNearClipPlane(this MotionBuilder builder, Camera camera) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(camera); return builder.Bind(camera, static (x, camera) => { camera.nearClipPlane = x; }); } /// /// Create a motion data and bind it to Camera.farClipPlane /// /// The type of special parameters given to the motion data /// The type of adapter that support value animation /// This builder /// /// Handle of the created motion data. public static MotionHandle BindToFarClipPlane(this MotionBuilder builder, Camera camera) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(camera); return builder.Bind(camera, static (x, camera) => { camera.farClipPlane = x; }); } /// /// Create a motion data and bind it to Camera.fieldOfView /// /// The type of special parameters given to the motion data /// The type of adapter that support value animation /// This builder /// /// Handle of the created motion data. public static MotionHandle BindToFieldOfView(this MotionBuilder builder, Camera camera) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(camera); return builder.Bind(camera, static (x, camera) => { camera.fieldOfView = x; }); } /// /// Create a motion data and bind it to Camera.orthographicSize /// /// The type of special parameters given to the motion data /// The type of adapter that support value animation /// This builder /// /// Handle of the created motion data. public static MotionHandle BindToOrthographicSize(this MotionBuilder builder, Camera camera) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(camera); return builder.Bind(camera, static (x, camera) => { camera.orthographicSize = x; }); } /// /// Create a motion data and bind it to Camera.rect /// /// The type of special parameters given to the motion data /// The type of adapter that support value animation /// This builder /// /// Handle of the created motion data. public static MotionHandle BindToRect(this MotionBuilder builder, Camera camera) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(camera); return builder.Bind(camera, static (x, camera) => { camera.rect = x; }); } /// /// Create a motion data and bind it to Camera.pixelRect /// /// The type of special parameters given to the motion data /// The type of adapter that support value animation /// This builder /// /// Handle of the created motion data. public static MotionHandle BindToPixelRect(this MotionBuilder builder, Camera camera) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(camera); return builder.Bind(camera, static (x, camera) => { camera.pixelRect = x; }); } /// /// Create a motion data and bind it to Camera.backgroundColor /// /// The type of special parameters given to the motion data /// The type of adapter that support value animation /// This builder /// /// Handle of the created motion data. public static MotionHandle BindToBackgroundColor(this MotionBuilder builder, Camera camera) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(camera); return builder.Bind(camera, static (x, camera) => { camera.backgroundColor = x; }); } } }