Prima::...::Fader(3)

πŸ“¦
version 1.74000 Β· 5 versions
, in opensuse-leap 16.0

πŸ¦‹ Prima::Widget::Fader β€” bestie, it's giving fade ✨

okay so real talk, this is the Prima::...::Fader(3) page (yes the header literally calls it Prima::...::Fader(3) in the corner, and the real class name is Prima::Widget::Fader, don't @ me, that's just how the docs roll πŸ’…). It lives in the User Contributed Perl Documentation section, and it's about making widgets fade in and out like the main characters they are.


🌸 NAME 🌸

Prima::Widget::Fader</p> β€” the fading-in/fading-out functions module. that's it, that's the vibe.


πŸ’– DESCRIPTION πŸ’–

So this role? It implements fading effects in widgets. that's the whole personality. a widget gets this role and suddenly it can glow up gradually instead of just appearing like some kind of jump-scare 😭 iconic behavior honestly.


✨ SYNOPSIS ✨

here's the whole ~look~ β€” literally copy this energy:

use base qw(Prima::Widget Prima::Widget::Fader);
{
my %RNT = (
        %{Prima::Widget-> notification_types()},
        %{Prima::Widget::Fader-> notification_types()},
);
sub notification_types { return \%RNT; }
}

sub on_mouseenter { shift-> fader_in_mouse_enter }
sub on_mouseleave { shift-> fader_out_mouse_leave }

sub on_paint
{
        my ( $self, $canvas ) = @_;
        $canvas->backColor( $self-> fader_prelight_color( $self-> hiliteBackColor ));
        $canvas->clear;
}

see how on_mouseenter kicks off fader_in_mouse_enter and on_mouseleave kicks off fader_out_mouse_leave? and on_paint grabs fader_prelight_color off of hiliteBackColor for that backColor glow-up? yeah. that's the whole demo. slay. 🫢


πŸ”₯ API πŸ”₯

ngl, the API is currently under design, so the only parts documented here are the ones that are expected to be staying intact. translation: don't get too attached to anything that isn't on this page, bestie πŸ’€

πŸŽ€ Methods πŸŽ€

  • fader_in_mouse_enter β€” initiates a fade-in transition, and calls repaint on each and every step. every step! committed. ✨
  • fader_out_mouse_leave β€” initiates a fade-out transition, and yep, calls repaint on each step too. symmetrical queen. πŸ’…
  • fader_current_value β€” returns the current fader value, in the range from 0 to 1. and if there's no current fading transition in effect? it returns "undef". sad but honest 😭
  • fader_prelight_color $COLOR [, $MULTIPLIER ] β€” given a base $COLOR, this increases (or decreases) its brightness according to fader_current_value, plus an eventual $MULTIPLIER that's expected to be in the range from 0 to 1. yes you can dial the drama up or down. obsessed. 🌈

πŸ¦‹ Events πŸ¦‹

  • FadeIn $ENDS_OK β€” called when fader_in_mouse_enter finishes the fading. the $ENDS_OK flag is set to 0 if the process was overridden by another fader call, and 1 otherwise. so like, did you actually finish or did someone else cut in? πŸ‘€
  • FadeOut $ENDS_OK β€” called when fader_out_mouse_leave finishes the fading. same deal: $ENDS_OK is 0 if the process was overridden by another fader call, 1 otherwise. fr fr. πŸ“
  • FadeRepaint β€” by default this repaints the whole widget, but you can overload it if only some widget parts need to reflect the fader effect. like if only the cheekbones need highlight, yk? highkey useful. πŸ’œ

πŸ‘‘ AUTHOR πŸ‘‘

Dmitry Karasik, <dmitry@karasik.eu.org>. respect the icon who wrote the fade. πŸŽ€


πŸ’« SEE ALSO πŸ’«

  • Prima::Widget β€” go read it, iykyk 🧚

and that's the page!! ✨ sourced from perl v5.42.0, dated 2024-08-20, and filed under Prima::...::Fader(3) in the manual. mwah, go make something fade πŸ’…πŸ’–

πŸ“¦ where this page comes from