-
Notifications
You must be signed in to change notification settings - Fork 6
Bounce
Saif Ahmed edited this page Sep 9, 2019
·
2 revisions
bounce.pl is a simple application that does a demonstration of timers. The graphical representation includes a timer line, and also the combo box that allows the user to choose from a number of animations.
my $window=<<END;
+--------------------------+
|T Animation |
+--------------------------+
| +I--------------------+ |
| | clock.svg | |
| | | |
| | | |
| | | |
| | | |
| | | |
| +---------------------+ |
| ^Choose ^ |
+--------------------------+
Choose=Slideshow,Spin,Bounce,Clock,ECG
timer 100 choose 1
END
The timer calls the a function called choose every 100 milliseconds. This function calls another function indicated by the contents of the combobox.
sub choose{ # This is the function called by the timer.
my $fn=lc($frame->getValue("combo2") );
my $sub=\&{$fn}; # Calls the function selected in the combo
$sub->();
}
This second function called then updates and loads an image to provide an animation.