using UnityEngine; namespace LitMotion.Extensions { /// /// Provides binding extension methods for Transform. /// public static class LitMotionTransformExtensions { /// /// Create a motion data and bind it to Transform.position /// /// 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 BindToPosition(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { t.position = x; }); } /// /// Create a motion data and bind it to Transform.position.x /// /// 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 BindToPositionX(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.position; p.x = x; t.position = p; }); } /// /// Create a motion data and bind it to Transform.position.y /// /// 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 BindToPositionY(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.position; p.y = x; t.position = p; }); } /// /// Create a motion data and bind it to Transform.position.z /// /// 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 BindToPositionZ(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.position; p.z = x; t.position = p; }); } /// /// Create a motion data and bind it to Transform.position.xy /// /// 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 BindToPositionXY(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.position; p.x = x.x; p.y = x.y; t.position = p; }); } /// /// Create a motion data and bind it to Transform.position.xz /// /// 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 BindToPositionXZ(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.position; p.x = x.x; p.z = x.y; t.position = p; }); } /// /// Create a motion data and bind it to Transform.position.yz /// /// 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 BindToPositionYZ(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.position; p.y = x.x; p.z = x.y; t.position = p; }); } /// /// Create a motion data and bind it to Transform.localPosition /// /// 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 BindToLocalPosition(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { t.localPosition = x; }); } /// /// Create a motion data and bind it to Transform.localPosition.x /// /// 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 BindToLocalPositionX(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.localPosition; p.x = x; t.localPosition = p; }); } /// /// Create a motion data and bind it to Transform.localPosition.y /// /// 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 BindToLocalPositionY(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.localPosition; p.y = x; t.localPosition = p; }); } /// /// Create a motion data and bind it to Transform.localPosition.z /// /// 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 BindToLocalPositionZ(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.localPosition; p.z = x; t.localPosition = p; }); } /// /// Create a motion data and bind it to Transform.localPosition.xy /// /// 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 BindToLocalPositionXY(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.localPosition; p.x = x.x; p.y = x.y; t.localPosition = p; }); } /// /// Create a motion data and bind it to Transform.localPosition.xz /// /// 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 BindToLocalPositionXZ(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.localPosition; p.x = x.x; p.z = x.y; t.localPosition = p; }); } /// /// Create a motion data and bind it to Transform.localPosition.yz /// /// 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 BindToLocalPositionYZ(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.localPosition; p.y = x.x; p.z = x.y; t.localPosition = p; }); } /// /// Create a motion data and bind it to Transform.rotation /// /// 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 BindToRotation(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { t.rotation = x; }); } /// /// Create a motion data and bind it to Transform.localRotation /// /// 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 BindToLocalRotation(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { t.localRotation = x; }); } /// /// Create a motion data and bind it to Transform.eulerAngles /// /// 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 BindToEulerAngles(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { t.eulerAngles = x; }); } /// /// Create a motion data and bind it to Transform.eulerAngles.x /// /// 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 BindToEulerAnglesX(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.eulerAngles; p.x = x; t.eulerAngles = p; }); } /// /// Create a motion data and bind it to Transform.eulerAngles.y /// /// 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 BindToEulerAnglesY(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.eulerAngles; p.y = x; t.eulerAngles = p; }); } /// /// Create a motion data and bind it to Transform.eulerAngles.z /// /// 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 BindToEulerAnglesZ(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.eulerAngles; p.z = x; t.eulerAngles = p; }); } /// /// Create a motion data and bind it to Transform.eulerAngles.xy /// /// 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 BindToEulerAnglesXY(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.eulerAngles; p.x = x.x; p.y = x.y; t.eulerAngles = p; }); } /// /// Create a motion data and bind it to Transform.eulerAngles.xz /// /// 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 BindToEulerAnglesXZ(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.eulerAngles; p.x = x.x; p.z = x.y; t.eulerAngles = p; }); } /// /// Create a motion data and bind it to Transform.eulerAngles.yz /// /// 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 BindToEulerAnglesYZ(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.eulerAngles; p.y = x.x; p.z = x.y; t.eulerAngles = p; }); } /// /// Create a motion data and bind it to Transform.localEulerAngles /// /// 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 BindToLocalEulerAngles(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { t.localEulerAngles = x; }); } /// /// Create a motion data and bind it to Transform.localEulerAngles.x /// /// 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 BindToLocalEulerAnglesX(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.localEulerAngles; p.x = x; t.localEulerAngles = p; }); } /// /// Create a motion data and bind it to Transform.localEulerAngles.y /// /// 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 BindToLocalEulerAnglesY(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.localEulerAngles; p.y = x; t.localEulerAngles = p; }); } /// /// Create a motion data and bind it to Transform.localEulerAngles.z /// /// 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 BindToLocalEulerAnglesZ(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.localEulerAngles; p.z = x; t.localEulerAngles = p; }); } /// /// Create a motion data and bind it to Transform.localEulerAngles.xy /// /// 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 BindToLocalEulerAnglesXY(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.localEulerAngles; p.x = x.x; p.y = x.y; t.localEulerAngles = p; }); } /// /// Create a motion data and bind it to Transform.localEulerAngles.xz /// /// 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 BindToLocalEulerAnglesXZ(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.localEulerAngles; p.x = x.x; p.z = x.y; t.localEulerAngles = p; }); } /// /// Create a motion data and bind it to Transform.localEulerAngles.yz /// /// 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 BindToLocalEulerAnglesYZ(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.localEulerAngles; p.y = x.x; p.z = x.y; t.localEulerAngles = p; }); } /// /// Create a motion data and bind it to Transform.localScale /// /// 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 BindToLocalScale(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { t.localScale = x; }); } /// /// Create a motion data and bind it to Transform.localScale.x /// /// 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 BindToLocalScaleX(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.localScale; p.x = x; t.localScale = p; }); } /// /// Create a motion data and bind it to Transform.localScale.y /// /// 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 BindToLocalScaleY(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.localScale; p.y = x; t.localScale = p; }); } /// /// Create a motion data and bind it to Transform.localScale.z /// /// 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 BindToLocalScaleZ(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.localScale; p.z = x; t.localScale = p; }); } /// /// Create a motion data and bind it to Transform.localScale.xy /// /// 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 BindToLocalScaleXY(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.localScale; p.x = x.x; p.y = x.y; t.localScale = p; }); } /// /// Create a motion data and bind it to Transform.localScale.xz /// /// 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 BindToLocalScaleXZ(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.localScale; p.x = x.x; p.z = x.y; t.localScale = p; }); } /// /// Create a motion data and bind it to Transform.localScale.yz /// /// 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 BindToLocalScaleYZ(this MotionBuilder builder, Transform transform) where TOptions : unmanaged, IMotionOptions where TAdapter : unmanaged, IMotionAdapter { Error.IsNull(transform); return builder.BindWithState(transform, static (x, t) => { var p = t.localScale; p.y = x.x; p.z = x.y; t.localScale = p; }); } } }