CHANGELOG
Version 0.1 (8th December 2015) - Initial release (included in Blastcity layout)
Version 1.0 (14th March 2016) - Complete rewrite to extend PreserveArt module
Version 1.1 (14th March 2016) - Added start_scale and randomize_on_transition
Version 1.2 (22th March 2016) - Fixed bug with bounce animation when art is smaller than surface
After a bit of prodding from Verion (ouch!), I finally got around to rewriting the PanAndScan module I included with my previous Blastcity layout!

This version of the module extends liquid8d's excellent PreserveArt module. I have included the most recent version (1.0) of his module in the archive. You can find this and his other projects hosted at his
github repo.
With liquid8d's module you can define an arbitrary space on the screen and place an art or image object in there, either scaled to fit within the space, or to fill it, while preserving the original aspect ratio.
My module extends this functionality by adding a "Pan and Scan" style animation to it. This allows you to either scroll the art/image object side to side, up and down, or in all four directions. It also allows you to zoom in to the image to a desired scale (happy now Verion?

).
Example usage:
fe.load_module("pan-and-scan");
local my_art = PanAndScanArt("flyer", 0, 0, 640,480);
my_art.set_fit_or_fill("fill");
my_art.set_anchor(::Anchor.Center);
my_art.set_zoom(4.5, 0.00008);
my_art.set_animate(::AnimateType.Bounce, 0.07, 0.07)
my_art.set_randomize_on_transition(true);
my_art.set_start_scale(1.15);
Breakdown of each command:
First thing we load the module into the layout...
fe.load_module("pan-and-scan");
Then create an instance of the module class. Arguments are: art type, x pos, y pos, surface width, surface height
(Also, you can replace PanAndScanArt() with PanAndScanImage() if you want to use an image in your layout directory)
local my_art = PanAndScanArt("flyer", 0, 0, 640, 480);
Tell the module whether you want to make the loaded art/image "fit" the size of the surface you've created, or to "fill" the surface. I'd recommend sticking with "fill" for the purpose of this module, though you may find a use for "fit" in some cases.
my_art.set_fit_or_fill("fill");
Configure the anchor point for the art/image. When you have zooming and scrolling going on, I find Center to be the best option here. Other choices for the ::Anchor table include .Left, .Top, .Center, .Centre (same as .Center), .Right, and .Bottom.
my_art.set_anchor(::Anchor.Center);
Here is where the fun stuff starts (no offence to liquid8d!). Arguments are: zoom scale, zoom speed
For the scale, note that 1.0 is the actual art/image scale displayed on the surface prior to zooming. So, if you want to end up with the image doubled in size at the end of the zoom animation, you'd enter 2.0
my_art.set_zoom(2.5, 0.0002);
This sets the pan and scan animation. Arguments are: animation type, x/y speed, [y speed].
Choices for the ::AnimateType table include .Bounce, .HorizBounce, and .VertBounce. If using Horiz or Vert, only 1 speed argument is needed.
my_art.set_animate(::AnimateType.Bounce, 0.1, 0.1)
Enabling this will randomize the pan animation direction when transitioning to another list item.
my_art.set_randomize_on_transition(true);
Alter the starting scale of the image after it has been processed by PreserveArt. I found this helps to remove some of the initial "wiggle" as the pan animation bounces from side to side at the beginning.
my_art.set_start_scale(1.15);
I think I've covered everything. Have a play around with it and see what you think. I mostly created this to have animated backgrounds, zooming and panning around large flyer images and such. Let me know if you manage to break it some how and I'll take a look, or if anyone has some suggestions for improvements then I'm all ears!