top of page

Lerper / Tweener

namespace - XGI.Tools

Lerping - Tweening is made as simple as possible

How to to Lerp -

using UnityEngine;
using XGI.Tools;

public class SampleScript : MonoBehaviour
    public GameObject objectToMove;
    public Transform targetPosition;

    private void OnEnable()
        Lerper lerper = objectToMove.AddComponent<Lerper>();

How to extract the journey progress percentage of the lerped object -

float completed = lerper.progress;

Replace Lerper with Tweener it everything will still work


  • float progress => Journey progress percentage

Lerper Methods

  • void MoveObject(Transform moveToPosition, float Movementspeed = 10, bool destroyGameObjectAfterLerping = false) => Makes the GameObject move

Tweener Methods

  • void MoveObject(RectTransform moveToPosition, float timeTaken = 1, bool destroyGameObjectAfterTweening = false) => Makes the UI object move

bottom of page