Scroll to navigation

Prima::Widget::Fader(3) User Contributed Perl Documentation Prima::Widget::Fader(3)

NAME

Prima::Widget::Fader - fading- in/out functions

DESCRIPTION

The role implements fading effects in widgets

SYNOPSIS

        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;
        }

API

The API is currently under design so the parts that are documented are those that expected to be staying intact.

Methods

Initiates a fade-in transition, calls repaint on each step.
Initiates a fade-out transition, calls repaint on each step.
Returns the current fader value in the range from 0 to 1. Returns "undef" if there is no current fading transition in effect
Given a base $COLOR, increases (or decreases) its brightness according to "fader_current_value" and an eventual $MULTIPLIER that is expected to be in the range from 0 to 1.

Events

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, 1 otherwise.
Called when "fader_out_mouse_leave" finishes the fading, the $ENDS_OK flag is set to 0 if the process was overridden by another fader call, 1 otherwise.
By default repaints the whole widget, but can be overloaded if only some widget parts need to reflect the fader effect.

AUTHOR

Dmitry Karasik, <dmitry@karasik.eu.org>.

SEE ALSO

Prima::Widget

2024-02-01 perl v5.38.2