Logo
Effects

Image Gradient

Apply a vertex gradient to a UI Graphic

Overview

Image Gradient applies gradient colors to a Graphic's mesh.

Preview

Usage

Add Image Gradient to the Graphic you want to tint.

Edit the gradient and choose its direction.

Select how it blends with existing vertex colors.

Adjust angle, zoom, offset, or reverse direction.


Public API

Use ImageGradient in the Evo.UI namespace.

Call UpdateGradient() after editing gradientEffect in place.

Fields

NameTypeDescription
gradientEffectGradientGradient applied to the vertices.
gradientTypeTypeHorizontal or Vertical base direction.
blendModeBlendModeHow gradient colors combine with existing colors.
anglefloatGradient rotation.
effectOffsetfloatGradient offset.
zoomfloatGradient scale.
reverseboolReverses color order.

Methods

NameParametersDescription
UpdateGradient()NoneMarks the gradient for refresh.
SetGradient()Gradient newGradientReplaces the gradient.
SetGradientColors()Color startColor, Color endColorCreates a two-color gradient.

Example

ImageGradientExample.cs
using UnityEngine;
using Evo.UI;

public class ImageGradientExample : MonoBehaviour
{
    [SerializeField] private ImageGradient target;

    private void Start()
    {
        target.SetGradientColors(Color.cyan, Color.blue);
        target.angle = 30f;
        target.UpdateGradient();
    }
}

On this page