Smooth Move

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
xfratboy
Posts: 97
Joined: Fri Mar 05, 2010 9:09 pm

Smooth Move

Post by xfratboy » Wed Sep 15, 2010 6:13 pm

I'm having some issues with jumpy move behavior. I'm wondering if there are any tricks to achieving smoother moves. Here's what I'm doing right now. It works fine on my XP machine but on my Vista machine I can really see the jumpiness. I've tried different syncrates from 0-20 but it just gets worse using any syncrate over 1. I read somewhere on the forum that someone else had the same problem and ended up having to use 'set loc' process over the move command to achieve better performance. Seems like a possible solution but just curious if there were other ideas. Thanks.

Code: Select all

Set the syncrate to 1
repeat for 50 times
   move  graphic "whatever" from PointA to PointB in 1500 milliseconds  
            play BeepSoundL
            wait 2 milliseconds with messages
            move  graphic "whatever" from PointB to PointA in 1500 milliseconds
            play BeepSoundR
            Wait 2 milliseconds with messages
    if gCancelLoop is true then exit repeat
 end repeat

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Smooth Move

Post by bn » Wed Sep 15, 2010 9:16 pm

xFratBoy,
I don't know about the difference between the graphic handling of Rev regarding XP and Vista. I am afraid Rev is somewhat limited in complex moves. But then your task is not that complicated. On a Mac I also get jerky movements at the default syncrate of 20, reducing the syncrate to 10 makes the movement smooth. You could try the little different approach I took in the code below, but I doubt that it makes much difference. It is just a way to avoid repeat loops which are blocking. Since you interspersed some wait with messages that helps the engine to do its housekeeping.

Code: Select all

global gCancelLoop
local sPointA, sPointB, sCounter, sHowOften

on mouseUp
   put 50 & "," & item 2 of the loc of this card into sPointA
   put the width of this card - 50 & "," & item 2 of the loc of this card into sPointB
   put false into gCancelLoop
   put 0 into sCounter
   Set the syncrate to 10
   put 10 into sHowOften
   send moveGraphic to me in 0 milliseconds
end mouseUp

on moveGraphic
   if sCounter <= sHowOften and (not gCancelLoop) then
      add 1 to sCounter
      if sCounter mod 2 = 0 then
         -- play BeepSoundR -- you might have to switch this
         move  graphic "whatever" from sPointA to sPointB in 1500 milliseconds  without waiting
      else
         -- if sCounter > 1 then play BeepSoundL
         move  graphic "whatever" from sPointB to sPointA in 1500 milliseconds without waiting
      end if
      if moveGraphic is not in the pendingMessages then
         send moveGraphic to me in 1550 milliseconds
      end if
   end if
end moveGraphic
other than that I don't know of any trick to improve the move command
regards
Bernd

xfratboy
Posts: 97
Joined: Fri Mar 05, 2010 9:09 pm

Re: Smooth Move

Post by xfratboy » Thu Sep 16, 2010 4:34 am

Thanks for the thoughts on this. I don't really see much of a change though (as you suspected). I made a little scrollbar that changes the syncrate while moving and found out that some screens look slightly better with different sync rates. As a test, I connected my LCD TV up to my HDMI port on the laptop and adjusted syncrate during graphic movement. A syncrate of 7~10 looked better on the TV and a syncrate of 1 looks better on the laptop's display. Additionally, when connected to an LCD projector the jumpiness is profound.

Post Reply