
;********************************************************************
;
; (c) Mik of ClassX 1995
;
;
; How to pack a sequence of frames
;
;********************************************************************


XINCLUDE "LIB_XFA.BB"

WBStartup
NoCli
DEFTYPE.l


;open destination screen
Screen 0,0,0,640,512,2,$8004,"",2,1
ScreensBitMap 0,0

;set a visible palette
PalRGB 0,0,0,0,$f
Use Palette 0

;allocate some frames
If XFA_AllocFrames_(500)

  ;set pack screen and packmode for library use  (change mode here)
  XFA_SetPack_ Peek.l(Addr Screen(0)),#XFA_MODE32I

  ;open pack stuff
  If XFA_OpenPackStuff_

    c=0
    ;init pack sequence
    If XFA_PosOnFrame_(c)
      For i=0 To 359 Step 3
        x = Sin(i*Pi/180)*200+320
        y = Cos(i*Pi/180)*200+256

        ;silly draw
        Circle x,y,50,1
        Circle x,y,49,1
        Circle x,y,48,2
        Circle x,y,47,2

        ;attempt to pack the frame
        If XFA_PutFrame_(c)=0
          ;error handling
        EndIf

        c+1

      Next i
    EndIf



    c=0
    ;init another pack sequence
    If XFA_PosOnFrame_(c)
      For i=0 To 359 Step 3
        x = Sin(3*i*Pi/180)*200+320
        y = Cos(5*i*Pi/180)*200+256

        ;silly draw
        Circle x,y,50,1
        Circle x,y,49,1
        Circle x,y,48,2
        Circle x,y,47,2

        ;attempt to pack the frame
        If XFA_PutFrame_(c)=0
          ;error handling
        EndIf

        c+1

      Next i
    EndIf


    ;done: close pack stuff and put loop frames
    XFA_ClosePackStuff_(#CLOSE_LOOP)

    ;now we can save the animation
    If XFA_SaveAnim_("t:a.xfa")<>0
      ;error handling
    EndIf


  EndIf

  ;free animation frames and array
  XFA_FreeFrames_

EndIf


End









