Page 1 of 1

Moving large image

Posted: Sun Dec 11, 2011 11:32 pm
by richardmac
For an iPad app we're working on, we want to animate the movement of a very large image. Doesn't matter whether I use animationEngine or script it myself, I am incapable of doing anything resembling smooth animation. I don't mean "it's a little jumpy", I mean it's doing 4 frames a second.

We have a big image that covers the screen. We want to be able to animate the image to move 200 pixels up, revealing a "Dock" area at the bottom of the card. No matter what I try, I'm getting dismal performance on the iPad. This is with LiveCode 5.0.1.

I've set the layermode of the image to "Dynamic." I'm setting the acceleratedRendering to "True." I'm setting the Quality to "Normal."

If the image were plain, I could just use a visual effect and use two cards to accomplish what I want or even lock the card and do a visual effect unlock. But the image has patterns on it, so none of the visual effects work. Which is unfortunate, because the visual effects work very smoothly.

Any ideas or suggestions appreciated. I would imagine this would be the same problem as someone building a game where the background is moving left to right. At 4 frames a second it'd be ugly.

Re: Moving large image

Posted: Mon Dec 12, 2011 12:31 am
by richardmac
Eww. Doing a forum search all I can find is more of the same. Decent animation of large objects on an iPad looks to be impossible...

Re: Moving large image

Posted: Mon Dec 12, 2011 6:10 am
by Jellicle
Try this:

http://dl.dropbox.com/u/67170/dockexample.livecode

I'm not using a really huge image, but it demonstrates one solution. BTW you can drag the image around to see it work wherever the image is.

Gerry

Re: Moving large image

Posted: Mon Dec 12, 2011 10:25 pm
by richardmac
Gerry,
Thanks for sharing your stack with me. I had some difficulties opening it on my iPad, but I was able to look at the scripts.

I ended up figuring out a pretty good workaround for my issue. I put the image in a group and set the group to be the size of the iPad screen, then I used iphoneControlCreate "scroller" to allow the iOS to speed up the scrolling. Then I used a repeat loop to change the vscroll of the group. It actually works pretty darn good - I wouldn't call it super smooth, but it's got to be 4 times faster than doing it the old way. It's good enough for our app, though.

Re: Moving large image

Posted: Mon Dec 12, 2011 10:43 pm
by Jellicle
richardmac wrote:Gerry,
Thanks for sharing your stack with me. I had some difficulties opening it on my iPad, but I was able to look at the scripts.
Did it run in the simulator? Anyway, glad you found a solution (although it seems very complicated :))

Gerry

Re: Moving large image

Posted: Tue Dec 13, 2011 2:32 am
by richardmac
Hmm. Didn't try it in the simulator until just now. It works, but it's not animated - it sort of dissolves and reappears really quickly, which is not the same as seeing it actually move, which is what we needed. But yeah, our workaround is complicated, but the animation is reasonably smooth.

Re: Moving large image

Posted: Tue Dec 13, 2011 6:59 am
by Jellicle
richardmac wrote:Hmm. Didn't try it in the simulator until just now. It works, but it's not animated - it sort of dissolves and reappears really quickly, which is not the same as seeing it actually move, which is what we needed. But yeah, our workaround is complicated, but the animation is reasonably smooth.
You can use the move command instead. I didn't, as for some reason I got sucked in by your mention of visual effects :)

Gerry

Re: Moving large image

Posted: Tue Dec 13, 2011 7:10 am
by Jellicle
I've updated the stack to use the move command. Use the same link.

Gerry

Re: Moving large image

Posted: Tue Dec 13, 2011 10:10 pm
by richardmac
Jellicle wrote:I've updated the stack to use the move command. Use the same link.

Gerry
Yup - got it. That works well - pretty much the same speed as the workaround, but way easier and way more logical. Sweet! Thanks for taking the time to do this - I really appreciate it. :)

Re: Moving large image

Posted: Wed Dec 14, 2011 2:55 am
by Jellicle
My pleasure :)

g