DemonicButton

A hold-to-summon button that raises ridged devil horns from behind it while a particle fire builds into a roar.

Preview

Loading GPUI

Install

cargo add evilbuttons

Usage

use evilbuttons::DemonicButton;
use gpui::{div, prelude::*, Context, IntoElement, Render, Window};
use std::time::Duration;

struct ButtonDemo;

impl Render for ButtonDemo {
    fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
        div().child(
            DemonicButton::new("corrupt")
                .label("Corrupt the World")
                .hold_duration(Duration::from_millis(1800))
                .on_summon(|_, _| println!("Summoned")),
        )
    }
}

Variants

Quick summon

Shorten hold_duration for a faster ritual.

Loading GPUI
DemonicButton::new("sell-soul")
    .hold_duration(Duration::from_millis(900))
    .label("Sell Soul")

Props

DemonicButton is a GPUI RenderOnce builder; its charge and fire are keyed by id.

MethodTypeDefaultDescription
new(id)impl Into<ElementId>-Unique id for the charge and fire state.
label(s)impl Into<SharedString>"Summon"Button label.
hold_duration(d)Duration2200msHow long the hold takes to fully summon.
on_summon(f)Fn(&mut Window, &mut App)-Fired once each time the charge reaches 100%.
disabled(bool)boolfalseDims the button and ignores input.

Good to know

  • The fire is a particle system simulated every frame; each particle is a Gaussian-blurred disc standing in for the original's radial-gradient sprites.
  • The horns are the original SVG paths, painted as GPUI paths; their four-stop gradient is drawn as thin bands.
  • Release early and the charge drains 2.4× faster than it filled. Hold Space or Enter to summon from the keyboard.

Search docs

Jump to a button documentation page