7 our $timer = AA->new('T');
8 $timer->DefSet('T', 0);
11 return $timer->Get('T');
15 my ($class, $after, $sub) = @_;
16 my $t = $now + $after;
17 push @timer_queue, [ $t, $sub ];
18 print "@@@ Adding timer for $t\n" if $debug;
19 @timer_queue = sort { $a->[0] <=> $b->[0] } @timer_queue;
23 my ($class, $sub) = @_;
24 push @timer_queue, [ 1000000, $sub ];
28 AA::Anim->add_final(sub { });
33 print "@@@ Tick tock: it's $now o'clock\n" if $debug;
34 $timer->Set('T', $now);
37 print "@@@ idle\n" if $debug;
39 } elsif ($timer_queue[0]->[0] >= 1000000) {
40 while ($tm = shift @timer_queue) {
41 print "@@@ finalizer\n" if $debug;
45 while (@timer_queue && $timer_queue[0]->[0] <= $now) {
46 print "@@@ timer for ", $timer_queue[0]->[0], "\n" if $debug;
47 $tm = shift @timer_queue;
56 my ($class, $x0, $x1, $dt) = @_;
59 my $t = AA::Anim->now;
60 if ($t - $t0 >= $dt) {
63 return $x0 + ($x1 - $x0) * ($t - $t0)/$dt;