Another examples of the screen refresh problem on the Mac?

James Hurley jhurley0305 at sbcglobal.net
Mon Oct 10 22:42:39 EDT 2011


Ken,

The script I sent you was just an example and I simplified what I ultimately would like to try.

I would like, for example, to simulate dynamical motion, for example projectile motion, and that requires fairly close spacing of the points. Or motion around an elliptical orbit. Generally this is done with a repeat loop and setting the location with each successive time interval in the motion, rather than using the move command along a predefined set of points. 

The thing I was going to try was to first calculate all the points, the complete trajectory,  and then "move" the icon along those points. The problem is coordinating this movement with other things that are moving as well. That is much easier to control with a repeat loop. 

 But I can do what I have done before, in the game of pool for example where one relies on RR's speed of execution to allow the sequential motion of each ball to give the appearance of concurrent movement. 

I just got a personal note from Benrd Niggemann who has experimented with a number of parameters affecting the smoothness of the motion. He has found, and I I have just confirmed it myself, that setting the syncrate (I was totally unaware of such a property) to 6 rather than the default of 20 is very helpful. That is to say, SLOWING the screen update INCREASES the smoothness of the motion. Go figure. It is still necessary to force a screen refresh with an "unlcok screen" command after each step.  I haven't a clue what goes on behind the scene in this regard. 

I have been putting together a graphics library to share, following the good example of Peter Brigham who recently shared his library of utilities for text parsing and processing. 

Well, back to the drawing board--almost literally, And thank you again for testing this more me. The feedback was very helpful.

Jim Hurley


> I get the same jerky effect that you get. Now that I see the code, I think the issue is that you're doing a single pixel move for both objects; when I spread that out to do that every 8 pixels, it was smooth:
> 
> on mouseUp
>      put 200 into x
>      put 200 into y
>      put 2 into dx
>      put 1 into dy
>    
>      repeat 25 times
>            put x,y & cr after tPoints
>            add (4*dx) to x
>      end repeat
>    
>      put 200 into x
>      put 200 into y
>      repeat 25 
>            put x,y & cr after tNewPoints
>            add (8*dy) to y
>      end repeat
>    
>      lock moves
>      move button "one" to tNewPoints without waiting
>      move button "two" to tPoints without waiting
>      unlock moves
>    
> end mouseUp
> 
> Will that work for you? Or do you really need to move the objects in 1 pixel increments?
> 
> Ken Ray
> Sons of Thunder Software, Inc.
> Email: 
> kray at sonsothunder.com
> 
> Web Site: 
> http://www.sonsothunder.com/	




More information about the use-livecode mailing list