… | |
… | |
432 | C<$seconds> seconds. |
432 | C<$seconds> seconds. |
433 | |
433 | |
434 | Example: load some image and rotate it according to the time of day (as if it were |
434 | Example: load some image and rotate it according to the time of day (as if it were |
435 | the hour pointer of a clock). Update this image every minute. |
435 | the hour pointer of a clock). Update this image every minute. |
436 | |
436 | |
437 | again 60; rotate TW, TH, 50, 50, (now % 86400) * -720 / 86400, scale load "myclock.png" |
437 | again 60; rotate 50, 50, (now % 86400) * -720 / 86400, scale load "myclock.png" |
438 | |
438 | |
439 | =item counter $seconds |
439 | =item counter $seconds |
440 | |
440 | |
441 | Like C<again>, but also returns an increasing counter value, starting at |
441 | Like C<again>, but also returns an increasing counter value, starting at |
442 | 0, which might be useful for some simple animation effects. |
442 | 0, which might be useful for some simple animation effects. |
… | |
… | |
629 | |
629 | |
630 | sub rootalign($) { |
630 | sub rootalign($) { |
631 | move -TX, -TY, $_[0] |
631 | move -TX, -TY, $_[0] |
632 | } |
632 | } |
633 | |
633 | |
634 | =item rotate $center_x, $center_y, $degrees, $new_width, $new_height |
634 | =item rotate $center_x, $center_y, $degrees |
635 | |
635 | |
636 | Rotates the image by C<$degrees> degrees, counter-clockwise, around the |
636 | Rotates the image by C<$degrees> degrees, counter-clockwise, around the |
637 | pointer at C<$center_x> and C<$center_y> (specified as factor of image |
637 | pointer at C<$center_x> and C<$center_y> (specified as factor of image |
638 | width/height), generating a new image with width C<$new_width> and height |
638 | width/height). |
639 | C<$new_height>. |
|
|
640 | |
639 | |
641 | #TODO# new width, height, maybe more operators? |
640 | #TODO# new width, height, maybe more operators? |
642 | |
641 | |
643 | Example: rotate the image by 90 degrees |
642 | Example: rotate the image by 90 degrees |
644 | |
643 | |
645 | =cut |
644 | =cut |
646 | |
645 | |
647 | sub rotate($$$$$$) { |
646 | sub rotate($$$$) { |
648 | my $img = pop; |
647 | my $img = pop; |
649 | $img->rotate ( |
648 | $img->rotate ( |
650 | $_[0] * $img->w, |
649 | $_[0] * $img->w, |
651 | $_[1] * $img->h, |
650 | $_[1] * $img->h, |
652 | $_[2] * (3.14159265 / 180), |
651 | $_[2] * (3.14159265 / 180), |
653 | $_[3], |
|
|
654 | $_[4], |
|
|
655 | ) |
652 | ) |
656 | } |
653 | } |
657 | |
654 | |
658 | =back |
655 | =back |
659 | |
656 | |