EvilEyeButton

An obsidian pill with a burning evil eye behind its label that tracks the cursor across the page, focuses on hover, and blinks.

Preview

Loading GPUI

Props

Install

cargo add evilbuttons

Usage

use evilbuttons::EvilEyeButton;
use gpui::rgb;

EvilEyeButton::new("watcher").eye_color(rgb(0x38bdf8))

Props

EvilEyeButton is a GPUI RenderOnce builder; its eye state is keyed by id. Every eye prop can change between renders without resetting the eye.

MethodTypeDefaultDescription
new(id)impl Into<ElementId>-Unique id for the eye state.
label(s)impl Into<SharedString>"I see you"Label, shown uppercase.
eye_color(c)impl Into<Hsla>#ff6f37Iris, glow, and hairline color.
intensity(v)f321.3Brightness of the flames.
pupil_size(v)f320.62Size of the slit pupil. Lower values make it tighter.
iris_width(v)f320.22Width of the iris ring.
glow_intensity(v)f320.5Strength of the glow around the iris.
scale(v)f321.7Size of the eye in the button. Higher values spread the flames wider.
noise_scale(v)f320.8Scale of the flame noise.
pupil_follow(v)f320.8How far the pupil tracks the cursor, 0 to 1.
flame_speed(v)f320.8Speed of the flames.
blink(bool)booltrueBlink every few seconds on its own. It always blinks on press.
font_family(family)impl Into<SharedString>inheritedFont family for the label.
on_click(f)Fn(&ClickEvent, &mut Window, &mut App)-Fired on click.
disabled(bool)boolfalseDims the button and ignores input.

Good to know

  • Ported from React Bits' EvilEye shader. GPUI has no custom shaders, so the same shader maths and noise texture run on the CPU each frame and are painted as small gradient strips (1px across, 2px down), which keeps the flames sharp at a reasonable cost.
  • The pupil follows the cursor across the whole window.
  • The label's soft eye-coloured glow is approximated with a blurred shadow behind the text, since GPUI has no text shadows.

Search docs

Jump to a button documentation page