Files
YachtDice/Assets/Plugins/AllIn13DShader/Demo/Scripts/DemoElementIntersectionGlow.cs
T
2026-02-23 22:24:46 +07:00

38 lines
601 B
C#

using UnityEngine;
namespace AllIn13DShader
{
public class DemoElementIntersectionGlow : DemoElement
{
private float timer;
public float speed;
public float minY;
public float maxY;
public Transform target;
private void OnEnable()
{
timer = 0f;
}
private void OnDisable()
{
timer = 0f;
}
public override void Update()
{
base.Update();
timer += Time.deltaTime;
float sin01 = (Mathf.Sin(timer * speed) + 1f) * 0.5f;
Vector3 localPos = target.localPosition;
localPos.y = Mathf.Lerp(minY, maxY, sin01);
target.localPosition = localPos;
}
}
}