Files
TRAfoer 725009e354 大幅优化
Signed-off-by: TRAfoer <lhf190@outlook.com>
2025-10-05 11:45:32 +08:00

25 lines
721 B
C#

using System.Collections;
using System.Collections.Generic;
using DG.Tweening.Core.Easing;
using Ichni;
using UnityEngine;
public static class WindowAnim
{
public static IEnumerator Shake(GameObject gameObject)
{
float timer = 0f;
Vector3 origpos = gameObject.transform.position;
while (timer <= 1f)
{
float offset = 50 * AnimationCurveEvaluator.Evaluate(AnimationCurveType.OutElastic, timer / 1f);
gameObject.transform.position = origpos + new Vector3(Random.Range(-offset, offset), Random.Range(-offset, offset), 0);
timer += Time.deltaTime;
yield return null;
}
gameObject.transform.position = origpos;
}
}