| 1 | sub Animation { # all plugin animation subroutines are named Animation() | ||
| 2 | |||
| 3 | # counter | ||
| 4 | # | ||
| 5 | # A simple counter just to demonstrate the essential features of a LockDisplay plugin. SOL, 98/09/19 | ||
| 6 | # | ||
| 7 | # Simply store your file in the plugin directory, with a subroutine named Animation(). You'll note | ||
| 8 | # that plugins have an initialization section that's executed once to preset widgets and variables. | ||
| 9 | # | ||
| 10 | # Stephen.O.Lidie@Lehigh.EDU, 98/09/20. | ||
| 11 | |||
| 12 | my($canvas) = @_; # canvas you can scribble upon | ||
| 13 | |||
| 14 | if ($init) { # if already initialized | ||
| 15 | $iteration ++; # increment counter | ||
| 16 | } else { # plugin initialization | ||
| 17 | $iteration = 1; # initialize counter | ||
| 18 | my($w, $h) = ($canvas->screenwidth, $canvas->screenheight); | ||
| 19 | my $l = $canvas->Label(-textvariable => \$iteration); | ||
| 20 | $canvas->createWindow($w/2, $h/2, -window => $l); | ||
| 21 | $init = 1; # plugin initialization complete | ||
| 22 | } # ifend initialization | ||
| 23 | |||
| 24 | 1; # the plugin returns 1 if success | ||
| 25 | |||
| 26 | } # end counter animation | ||
| 27 | |||
| 28 | 1; # all require files must signal success |