32 lines
769 B
C#
32 lines
769 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace XericLibrary.Runtime.MacroLibrary
|
|
{
|
|
/// <summary>
|
|
/// 缓动步进库
|
|
/// </summary>
|
|
public static class MacroInching
|
|
{
|
|
/// <summary>
|
|
/// 线性步进
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static double LinearTowards(double from, double to, double maxStepDelta)
|
|
{
|
|
return from + Math.Clamp(to - from, -maxStepDelta, maxStepDelta);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 线性步进
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static float LinearTowards(float from, float to, float maxStepDelta)
|
|
{
|
|
return (float)LinearTowards((double)from, (double)to, (double)maxStepDelta);
|
|
}
|
|
}
|
|
}
|