using UnityEngine;
using LitMotion.Adapters;
namespace LitMotion
{
///
/// The main class of the LitMotion library that creates and configures motion.
///
public static partial class LMotion
{
///
/// Create a builder for building motion.
///
/// Start value
/// End value
/// Duration
/// Created motion builder
public static MotionBuilder Create(float from, float to, float duration) => Create(from, to, duration);
///
/// Create a builder for building motion.
///
/// Start value
/// End value
/// Duration
/// Created motion builder
public static MotionBuilder Create(double from, double to, float duration) => Create(from, to, duration);
///
/// Create a builder for building motion.
///
/// Start value
/// End value
/// Duration
/// Created motion builder
public static MotionBuilder Create(int from, int to, float duration) => Create(from, to, duration);
///
/// Create a builder for building motion.
///
/// Start value
/// End value
/// Duration
/// Created motion builder
public static MotionBuilder Create(long from, long to, float duration) => Create(from, to, duration);
///
/// Create a builder for building motion.
///
/// Start value
/// End value
/// Duration
/// Created motion builder
public static MotionBuilder Create(Vector2 from, Vector2 to, float duration) => Create(from, to, duration);
///
/// Create a builder for building motion.
///
/// Start value
/// End value
/// Duration
/// Created motion builder
public static MotionBuilder Create(Vector3 from, Vector3 to, float duration) => Create(from, to, duration);
///
/// Create a builder for building motion.
///
/// Start value
/// End value
/// Duration
/// Created motion builder
public static MotionBuilder Create(Vector4 from, Vector4 to, float duration) => Create(from, to, duration);
///
/// Create a builder for building motion.
///
/// Start value
/// End value
/// Duration
/// Created motion builder
public static MotionBuilder Create(Quaternion from, Quaternion to, float duration) => Create(from, to, duration);
///
/// Create a builder for building motion.
///
/// Start value
/// End value
/// Duration
/// Created motion builder
public static MotionBuilder Create(Color from, Color to, float duration) => Create(from, to, duration);
///
/// Create a builder for building motion.
///
/// Start value
/// End value
/// Duration
/// Created motion builder
public static MotionBuilder Create(Rect from, Rect to, float duration) => Create(from, to, duration);
///
/// Create a builder for building motion.
///
/// The type of value to animate
/// The type of special parameters given to the motion entity
/// The type of adapter that support value animation
/// Start value
/// End value
/// Duration
/// Created motion builder
public static MotionBuilder Create(in TValue from, in TValue to, float duration)
where TValue : unmanaged
where TOptions : unmanaged, IMotionOptions
where TAdapter : unmanaged, IMotionAdapter
{
var buffer = MotionBuilderBuffer.Rent();
buffer.Data.StartValue = from;
buffer.Data.EndValue = to;
buffer.Data.Core.Duration = duration;
return new MotionBuilder(buffer);
}
}
}