This repository has been archived on 2025-09-23. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
XericLibrary-OLD/Runtime/MicroLibrary/MacroInching.cs

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);
}
}
}