Animation difficulty

Discuss any general programming issues here
Post Reply
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Animation difficulty

Post by djrikki »

Hi,

I am struggling to get the PlayAnim() command working with Async, here is my code snippet:

Code: Select all

assumptions:

googleads[8][0] = 160
googleads[8][1] = 600
frames[0] = 5
#ANIMBRUSH is a previously created brush containing frames[0] frames

        ExitOnError(False)
	    SelectDisplay(#PREVIEWWINDOW)
	   	EndDoubleBuffer()
	   	debugprint("number of frames to capture: " .. frames[0])
	    CreateAnim(1, #ANIMBRUSH, googleads[8][0], googleads[8][1], frames[0], frames[0])
	    Local obj
	    
	    obj = PlayAnim(1,0,0, {Async = True, Speed = #SLOWSPEED})
	    
	    Local framecount
	    framecount = GetAttribute(#ASYNCDRAW, obj, #ATTRNUMFRAMES)
        
        debugprint("no of frames identified via async: " .. framecount)
        
        For Local f = 0 to framecount
            debugprint("here")
			AsyncDrawFrame(obj, f)
			VWait()

		Next
		FinishAsyncDraw(obj)
		FreeAnim(1)
		ExitOnError(True)
		
		BeginDoubleBuffer()
		animplaying = False
		
		SelectDisplay(#MAINWINDOW)
For whatever reason 'framecount' = 0 instead of the value contained in frames[0].
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Re: Animation difficulty

Post by djrikki »

Also don't understand why the command IsAnimPlaying() was removed surely this useful in some circumstances.
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
User avatar
airsoftsoftwair
Posts: 5887
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Animation difficulty

Post by airsoftsoftwair »

Asynchronous drawing is not implemented properly for PlayAnim() because it doesn't make too much sense for PlayAnim(). Drawing the single frames on your own using DisplayAnimFrame() should be much more convenient than setting up an asynchronous drawing object on PlayAnim(). It also gives you greater control over anim playback.
djrikki wrote:Also don't understand why the command IsAnimPlaying() was removed surely this useful in some circumstances.
Having fully asynchronous anim playback means a lot of work for little gain. It's much easier to do the animation effect on your own by just using DisplayAnimFrame().
Post Reply