From acea7b2e728787a0d83bbf83c8c1f042d2c32e7e Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Mon, 3 Jun 2024 10:15:45 +0800 Subject: + plugins project --- .../MonoGame.Extended.Tweening/LinearOperations.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Plugins/MonoGame.Extended/source/MonoGame.Extended.Tweening/LinearOperations.cs (limited to 'Plugins/MonoGame.Extended/source/MonoGame.Extended.Tweening/LinearOperations.cs') diff --git a/Plugins/MonoGame.Extended/source/MonoGame.Extended.Tweening/LinearOperations.cs b/Plugins/MonoGame.Extended/source/MonoGame.Extended.Tweening/LinearOperations.cs new file mode 100644 index 0000000..12a03a8 --- /dev/null +++ b/Plugins/MonoGame.Extended/source/MonoGame.Extended.Tweening/LinearOperations.cs @@ -0,0 +1,21 @@ +using System; +using System.Linq.Expressions; + +namespace MonoGame.Extended.Tweening; + +public class LinearOperations +{ + static LinearOperations() + { + var a = Expression.Parameter(typeof(T)); + var b = Expression.Parameter(typeof(T)); + var c = Expression.Parameter(typeof(float)); + Add = Expression.Lambda>(Expression.Add(a, b), a, b).Compile(); + Subtract = Expression.Lambda>(Expression.Subtract(a, b), a, b).Compile(); + Multiply = Expression.Lambda>(Expression.Multiply(a, c), a, c).Compile(); + } + + public static Func Add { get; } + public static Func Subtract { get; } + public static Func Multiply { get; } +} -- cgit v1.1-26-g67d0