C       EXECUTIVE FOR ANIMATION
C
C
        LOGICAL B1,B2,B3,B4,B5,B6,B7,B8,B9,B10,LP,F
        DIMENSION ANAME(2)
C
        COMMON/EYCEP/EYE(3),CEN(3),UP(3)
        COMMON/OIL/IVECT(200)
        COMMON/LINKIT/ISTRT,LINKS(6,15)
        COMMON/LIMITS/XMIN,XMAX,YMIN,YMAX
        COMMON/MOTION/ANIM(12,15)
C
        DATA B1,B2,B3,B4,B5,B6,B7,B8,B9,B10,LP,F/12*.FALSE./
        DATA ANAME(1),ANAME(2)/5HMENUS,4HSBIN/
C
C
        CALL CLEAR(.FALSE.)
        CALL DISPLY(0,750,IGET)
        ITAG=0
        IX=0
        IY=0
        CALL SETPEN(ITAG,LP,IX,IY)
C
C
        CALL SEEK(1,ANAME)
        READ(1) ISIZ,(IVECT(K),K=1,ISIZ)
        INC=1
        IFST=1
        IFIL=2000
2100    ITST=IVECT(INC+1)
        IF(ITST.EQ.57344)GO TO 2000
        INC=INC+1
        GO TO 2100
2000    IFIL=IFIL+1
        INC=INC+2
        CALL DISPLY(1,IFIL,IVECT,IFST,INC)
        IF(INC.EQ.ISIZ)GO TO 2200
        IFST=INC+1
        INC=IFST
        GO TO 2100
2200    CALL CLOSE(1)
C
C
        EYE(1)=0.
        EYE(2)=0.
        EYE(3)=17.
        CEN(1)=0.
        CEN(2)=0.
        CEN(3)=0.
        UP(1)=0.
        UP(2)=10.
        UP(3)=0.
        DIST=17.
        NEW=1
C
C
        CALL INITL
	CALL READIN
C
        CALL FILMOD(ISTRT)
        CALL DRAWIT(DIST,NEW,ISTRT)
C
C
        LP=.FALSE.
1       IF(.NOT.LP)GO TO 1
C
C
        DO 500 J=1,15
        DO 500 I=1,12
500     ANIM(I,J)=0.0
C
        ISTP=1
        SIGN=1.
C
99      CALL MENU(2,ITAG,ISTP)
        MOD=ITAG
        LP=.FALSE.
200     IF(.NOT.LP)GO TO 200
C       PAUSE 101
C
C
        IF(IY.GT.100)GO TO 99
        IF(IX.GT.800)GO TO 98
        IF(IX.LT.200)IWANT=3
        IF(IX.GT.500)IWANT=5
        IF(IX.GT.200.AND.IX.LT.500)IWANT=4
299     CALL MENU(IWANT,MOD,ISTP)
201     LP=.FALSE.
202     IF(.NOT.LP)GO TO 202
C
C
        IF(IY.GT.100)GO TO 99
        IF(IX.GT.600.AND.IX.LT.700)SIGN=-1.
        IF(IX.GT.500.AND.IX.LT.600)SIGN=1.
C
        IF(IX.LT.500)GO TO 21
        IF(IX.GT.800)GO TO 98
        GO TO 201
21      IF(IWANT.EQ.3)IND=4
        IF(IWANT.EQ.4)IND=7
        IF(IWANT.EQ.5)IND=10
C
        IF(IX.GT.400)ANIM(IND+2,MOD)=ANIM(IND+2,MOD)+SIGN
        IF(IX.LT.300)ANIM(IND,MOD)=ANIM(IND,MOD)+SIGN
        IF(IX.GT.300.AND.IX.LT.400)ANIM(IND+1,MOD)=ANIM(IND+1,MOD)+SIGN
        IF(IWANT.EQ.3)ANIM(1,MOD)=1.
        IF(IWANT.EQ.4)ANIM(2,MOD)=1.
        IF(IWANT.NE.5)GO TO 299
        ANIM(3,MOD)=1.
        DO 298 I=10,12
        IF(ANIM(I,MOD).EQ.0.)ANIM(I,MOD)=SIGN
298     CONTINUE
        ANIM(3,MOD)=1.
        GO TO 299
C
C
C
        SIGN=1.
98      IWANT=6
        CALL MENU(IWANT,MOD,ISTP)
203     LP=.FALSE.
204     IF(.NOT.LP)GO TO 204
C
        IF(IY.GT.100)GO TO 99
        IF(IX.GT.800.AND.IY.LT.50)GO TO 97
        IF(IX.GT.500.AND.IX.LT.600)SIGN=1.
        IF(IX.GT.600.AND.IY.LT.700)SIGN=-1.
        IF(IX.LT.500)ISTP=ISTP+IFIX(SIGN)
        IF(ISTP.EQ.0)ISTP=1
        GO TO 98
C
C
97      DO 96 I=2001,2009
96      CALL DISPLY(5,I)
        CALL TEXT(0,0,0,0,0)
C
C
C
        STEP=1./FLOAT(ISTP)
        DO 1000 K=1,ISTP
        DO 999 I=1,15
        DO 999 J=1,3
        IF(ANIM(J,I).EQ.0.)GO TO 999
        GO TO (901,902,903),J
901     AX=ANIM(4,I)*STEP
        AY=ANIM(5,I)*STEP
        AZ=ANIM(6,I)*STEP
        CALL ROTATE(AX,0.,0.,I)
        CALL ROTATE(0.,AY,0.,I)
        CALL ROTATE(0.,0.,AZ,I)
        GO TO 999
902     DX=ANIM(7,I)*STEP
        DY=ANIM(8,I)*STEP
        DZ=ANIM(9,I)*STEP
        CALL TRANS(DX,DY,DZ,I)
        GO TO 999
903     FX=(ABS(ANIM(10,I))**STEP)
        FY=(ABS(ANIM(11,I))**STEP)
        FZ=(ABS(ANIM(12,I))**STEP)
        IF(ANIM(10,I).LT.0.)FX=1./FX
        IF(ANIM(11,I).LT.0.)FY=1./FY
        IF(ANIM(12,I).LT.0.)FZ=1./FZ
        CALL SCALE(FX,FY,FZ,I)
999     CONTINUE
        CALL FILMOD(ISTRT)
        CALL DRAWIT(DIST,NEW,ISTRT)
1000    CALL PULSE(IDO,IF)
        LP=.FALSE.
        GO TO 1
        STOP
        END
