UnityScripterAI
Discord ↗
Link Copied to Clipboard
×
"move UI element on a curve using LeanTween"
using UnityEngine; using UnityEngine.UI; using System.Collections; using System.Collections.Generic; using LeanTween; public class MoveUIOnCurve : MonoBehaviour { public RectTransform uiElement; public Vector3[] curvePoints; public float duration = 1f; void Start() { // Create a list of Vector3 points from the curvePoints array List<Vector3> points = new List<Vector3>(); foreach (Vector3 point in curvePoints) { points.Add(point); } // Move the UI element along the curve using LeanTween LeanTween.move(uiElement, points.ToArray(), duration).setEase(LeanTweenType.easeInOutSine); } }