Effects
Ripple
A quick expanding and fading ripple effect for UI interactions
Overview
Ripple creates a custom shaped expanding ripple when interacting with UI elements. The effect mimics modern material style feedback and works on pointer clicks and submit actions. Ripples are instantiated at runtime, scale outward, fade, and then self destroy.
Usage
Add Ripple component to any UI object
Set Create On Click or Create On Submit depending on interaction
Optionally set a Ripple Parent to control where the effect spawns in the hierarchy
The component will automatically create a ripple effect on click
Properties
Preset
| Name | Type | Description |
|---|---|---|
shape | Sprite | Ripple image shape |
color | Color | Ripple color including alpha |
centered | bool | If true, ripple spawns at element center rather than pointer position |
duration | float | Time for the ripple animation |
size | float | Expansion scale multiplier |
Settings
| Name | Type | Description |
|---|---|---|
createOnClick | bool | Creates ripple on pointer click |
createOnSubmit | bool | Creates ripple on submit (keyboard, controller, etc.) |
rippleParent | Transform | Parent where the ripple instance will be created |
Static Methods
| Name | Parameters | Description |
|---|---|---|
Create(preset, parent, manageParent, forceCentered) | Preset, Transform, bool, bool | Spawns a ripple under a given parent. forceCentered overrides preset.centered |
Code Example
using UnityEngine;
using Evo.UI;
public class RippleExample : MonoBehaviour
{
public Ripple ripple;
void Start()
{
// Customize preset
ripple.preset.shape = someSprite; // Your circular or custom ripple sprite
ripple.preset.color = new Color(1f, 1f, 1f, 0.3f); // White with softer alpha
ripple.preset.centered = false; // Spawn at pointer by default
ripple.preset.duration = 0.45f; // Ripple lifetime
ripple.preset.size = 7f; // Expansion scale
// Interaction settings
ripple.createOnClick = true; // Create on pointer down
ripple.createOnSubmit = false; // Create on keyboard submit
}
// Manual ripple creation (for example when interacting by script)
public void SpawnCustomRipple(Transform target)
{
Ripple.Create(ripple.preset, target);
}
// Force a ripple to spawn centered
public void SpawnCenteredRipple(Transform target)
{
Ripple.Create(ripple.preset, target, false, true);
}
}