I got off on a tangent this evening and put together some code that simulates the “picture collage” screensaver that you’ve probably seen on your Mac.
You can see the effect here in a very short video:
http://instantvideowebpages.com/play/notmplvid.php?591
The code below has NOT been optimized, I just got it working and I need to get back on my real project, so here it is for anybody to pound on:
display.setStatusBar(display.HiddenStatusBar)
function shuffle(t)
local n = #t
while n \> 2 do
local k = math.random(n)
t[n], t[k] = t[k], t[n]
n = n - 1
end
return t
end
local whichPic = 0
local finRotate
local startRot
local testpic
local showPic
bgpics = {
"picroute66.jpg",
"picjuggling.jpg",
"picsquirrel.jpg",
"azsunset.jpg",
"mckinley.jpg"
}
shuffle(bgpics)
local function twistPic()
local twistRot = finRotate + 2
if finRotate \< 0 then
twistRot = finRotate - 2
end
transition.to(testpic, {time=500, rotation=twistRot, onComplete=showPic } )
end
function showPic()
if whichPic \< #bgpics then
whichPic = whichPic + 1
local xpos = math.random ( 0, 320-250 )
local ypos = math.random ( 40, 480-250 )
startRot = math.random ( -15, 15 )
math.randomseed( os.time() )
finRotate = math.random ( -10, 10 )
testpic = display.newImage( bgpics[whichPic], xpos, ypos )
testpic.alpha = 0
testpic:scale(3, 3)
testpic:rotate(startRot)
transition.to(testpic, {time=2000, alpha=1, xScale=.7, yScale=.7, rotation=finRotate, onComplete=twistPic } )
end
end
local function screenTapped(event)
if event.phase == "began" then
showPic()
end
end
Runtime:addEventListener("touch", screenTapped)
Just enter your own list of pictures (any number should work) and run. Tap the screen and the pictures will float down and land on the table.
If someone takes this code and makes it cooler, I’d love a copy. 
Jay
[import]uid: 9440 topic_id: 7347 reply_id: 307347[/import]