Logo
Effects

Rect Parallax

Move a UI layer in response to the pointer

Overview

Rect Parallax offsets a UI rectangle to create a subtle sense of depth as the pointer moves. It is the v2 name for Rect Depth.


Usage

Add Rect Parallax to the containing UI object.

Assign the child rectangle as Depth Object.

Set depth multiplier and follow speed.

Test the movement at the actual Canvas scale.


Tips

  • Use different depth multipliers across layers for a parallax composition. Enable unscaled time if movement should continue while the game is paused.
  • Keep movement on a separate visual child if a layout group controls the parent position.

Public API

Use RectParallax in the Evo.UI namespace.

Fields

NameTypeDescription
depthObjectRectTransformRectangle that receives the offset.
depthMultiplierfloatStrength of the parallax movement.
followSpeedfloatPointer-follow response setting.
useUnscaledTimeboolUses unscaled timing.

Example

RectParallaxExample.cs
using UnityEngine;
using Evo.UI;

public class RectParallaxExample : MonoBehaviour
{
    [SerializeField] private RectParallax target;

    private void Start()
    {
        target.depthMultiplier = 0.08f;
        target.useUnscaledTime = true;
    }
}

On this page