Frame-based animation

John Craig john at splash21.com
Sat Feb 11 15:59:11 EST 2012


Hi, Richard.  I tried a frame based demo animation with one main 
animation loop that locks the screen then updates all objects. I found 
that instead of trying to update certain objects at frame X, etc, 
updating everything on every frame worked best (for this particular demo 
anyway).  Objects don't have to be updated by whole pixels at a time - 
an object could, for example move by 0.1 pixels per frame.  You keep 
track of the decimal numbers (I used arrays) and the object would only 
really visibly update every 10th frame.

HTH

You can see the demo at http://youtu.be/jBSLJSaoE6M




On 11/02/2012 18:54, Richard MacLemale wrote:
> On Feb 11, 2012, at 1:33 PM, Ken Corey wrote:
>> I don't know what the engine does to the code...the code might be "compiled" (I use that term loosely) down, where evaluated code isn't.
>>
>> Hrm...can you abstract each little script enough to make little commands?
>>
>> on appearFlower
>>    set the loc of image "flower" to 400,401
>>    set the height of image "flower" to 150
>>    set the width of image "flower" to 150
>> end appearFlower
>>
>> in frame 30:
>>   appearFlower
>>
>>
>> Does that help?
> I've tried something similar, but I think I've stumbled across the real problem - my animation loop code must be awful, because the performance is terrible.  Inside of the loop, I just ran the following lines, one after the other:
>
>     put the long seconds into daStartSecs
>     answer the long seconds - daStartSecs
>
> And I got something like .476.  When I run those two lines outside of the loop, I get .000001.  So obviously I need to go back through the animation loop code I wrote and figure out what I'm doing wrong.  If I can figure this whole issue out, I'll post it to the forum, because it'll be too long to put on the list.  Thanks for taking the time to respond to me, Ken - I really appreciate it.  :)
>
> ---
> Richard MacLemale
> Music = http://www.richardmac.com
> Programming = http://www.macandchee.se
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>




More information about the use-livecode mailing list