Moving large image

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
richardmac
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 211
Joined: Sun Oct 24, 2010 12:13 am

Moving large image

Post by richardmac » Sun Dec 11, 2011 11:32 pm

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.

richardmac
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 211
Joined: Sun Oct 24, 2010 12:13 am

Re: Moving large image

Post by richardmac » Mon Dec 12, 2011 12:31 am

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...

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: Moving large image

Post by Jellicle » Mon Dec 12, 2011 6:10 am

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
14" MacBook Pro
Former LiveCode developer.
Now recovering.

richardmac
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 211
Joined: Sun Oct 24, 2010 12:13 am

Re: Moving large image

Post by richardmac » Mon Dec 12, 2011 10:25 pm

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.

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: Moving large image

Post by Jellicle » Mon Dec 12, 2011 10:43 pm

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
14" MacBook Pro
Former LiveCode developer.
Now recovering.

richardmac
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 211
Joined: Sun Oct 24, 2010 12:13 am

Re: Moving large image

Post by richardmac » Tue Dec 13, 2011 2:32 am

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.

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: Moving large image

Post by Jellicle » Tue Dec 13, 2011 6:59 am

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
14" MacBook Pro
Former LiveCode developer.
Now recovering.

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: Moving large image

Post by Jellicle » Tue Dec 13, 2011 7:10 am

I've updated the stack to use the move command. Use the same link.

Gerry
14" MacBook Pro
Former LiveCode developer.
Now recovering.

richardmac
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 211
Joined: Sun Oct 24, 2010 12:13 am

Re: Moving large image

Post by richardmac » Tue Dec 13, 2011 10:10 pm

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. :)

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: Moving large image

Post by Jellicle » Wed Dec 14, 2011 2:55 am

My pleasure :)

g
14" MacBook Pro
Former LiveCode developer.
Now recovering.

Post Reply