Beispiel #1
0
        }        //end ChooseFunc

        //
        public void Play(Rectangle rcWnd, Color color, bool bOpen)
        {
            AnimData ad = new AnimData();

            ad.effect = ChooseFunc();

            ad.bOpen         = bOpen;
            ad.iAfterimages  = m_iAfterimages;
            ad.iTotalSteps   = m_iTotalSteps;
            ad.iParameter    = m_iParameter;
            ad.rcWnd         = rcWnd;
            ad.color         = color;
            ad.ptCenter      = AnimUtil.CenterPoint(ad.rcWnd);
            ad.ptRelRightTop = new Point(rcWnd.Right - ad.ptCenter.X, rcWnd.Top - ad.ptCenter.Y);

            Animate(ad);
        }        //end Play
Beispiel #2
0
            public bool Show(AnimData AD)
            {
                switch (AD.animType)
                {
                case AnimOperation.AnimInit:
                    AD.effect.Buffer = MATRIXF.rotateMatrix(MATRIXF.fixed1 * 72, AD.ptCenter);
                    break;

                case AnimOperation.AnimDraw:
                case AnimOperation.AnimErase:
                {
                    Point ptBoxRel = new Point();

                    ptBoxRel.X = AD.ptRelRightTop.X * AD.iStep / AD.iTotalSteps;
                    ptBoxRel.Y = AD.ptRelRightTop.Y * AD.iStep / AD.iTotalSteps;

                    MATRIXF matrix;
                    double  fxScale;

                    fxScale = MATRIXF.fixedDiv((AD.iTotalSteps - AD.iStep) * 4, AD.iTotalSteps * 3);
                    matrix  = MATRIXF.offsetMatrix(AD.ptRelRightTop.X, AD.ptRelRightTop.Y) *
                              MATRIXF.scaleMatrix(fxScale, fxScale, AD.ptCenter) *
                              MATRIXF.rotateMatrix(MATRIXF.fixedDiv(AD.iParameter * AD.iStep, AD.iTotalSteps), AD.ptCenter);

                    Point ptBoxCenter;
                    ptBoxCenter = AD.ptCenter * matrix;

                    for (int iLoop = 0; iLoop < 5; iLoop++)
                    {
                        drawBox(ptBoxCenter, ptBoxRel, AD.color);
                        ptBoxCenter = ptBoxCenter * (MATRIXF)AD.effect.Buffer;
                    }                                    //end for

                    break;
                }                //end case
                }                //end switch

                return(true);
            }    //end Show
Beispiel #3
0
            public bool Show(AnimData AD)
            {
                FWData fw = ((FWData)AD.effect.Buffer);

                switch (AD.animType)
                {
                case AnimOperation.AnimInit:
                {
                    Point[] ptCenter     = fw.ptCenter;
                    Point   ptRectCenter = new Point();


                    ptRectCenter.X = AD.ptCenter.X;
                    ptRectCenter.Y = AD.ptCenter.Y + (AD.ptRelRightTop.X + AD.ptRelRightTop.Y) * 5 / 3;

                    for (int idx = 0; idx < FWData.NRECT; idx++)
                    {
                        MATRIXF matrix = MATRIXF.rotateMatrix(idx * (360 * MATRIXF.fixed1 / FWData.NRECT), AD.ptCenter);
                        ptCenter[idx] = ptRectCenter * matrix;
                    }                                    //end for

                    break;
                }                                //end case

                case AnimOperation.AnimDraw:
                case AnimOperation.AnimErase:
                {
                    Point ptTemp = new Point();

                    double fixedFactor = MATRIXF.fixedDiv(AD.iStep, AD.iTotalSteps);

                    MATRIXF matrix;

                    Point[] ptRect = new Point[4];
                    Point[] ptTmp  = new Point[4];

                    ptRect[0].X = ptRect[3].X = -AD.ptRelRightTop.X;
                    ptRect[1].X = ptRect[2].X = AD.ptRelRightTop.X;
                    ptRect[0].Y = ptRect[1].Y = AD.ptRelRightTop.Y;
                    ptRect[2].Y = ptRect[3].Y = -AD.ptRelRightTop.Y;

                    for (int idx = 0; idx < FWData.NRECT; idx++)
                    {
                        matrix = MATRIXF.scaleMatrix(fixedFactor, fixedFactor) *
                                 MATRIXF.rotateMatrix((MATRIXF.fixed1 - fixedFactor) * AD.iParameter);

                        ptTemp = MATRIXF.mix(AD.ptCenter, fw.ptCenter[idx], fixedFactor);
                        matrix = matrix * MATRIXF.offsetMatrix(ptTemp.X, ptTemp.Y);

                        for (int iAngle = 0; iAngle < 4; iAngle++)
                        {
                            ptTmp[iAngle] = ptRect[iAngle] * matrix;
                        }

                        drawPoly(ptTmp, AD.color);
                    }                                    //end for

                    break;
                }                //end case
                }                //end switch

                return(true);
            }    //end Show
Beispiel #4
0
            public bool Show(AnimData AD)
            {
                SpikeData sd = ((SpikeData)AD.effect.Buffer);

                switch (AD.animType)
                {
                case AnimOperation.AnimInit:
                {
                    int xLeft   = AD.rcWnd.Left;
                    int xRight  = AD.rcWnd.Right;
                    int yTop    = AD.rcWnd.Bottom;
                    int yBottom = AD.rcWnd.Top;

                    for (int idx = 0; idx < 16; idx++)
                    {
                        Point[] pTriangle = sd.ptTriangleEnd[idx];

                        pTriangle[0] = AD.ptCenter;

                        if (idx < 4)
                        {
                            pTriangle[1].X = pTriangle[2].Y = yTop;
                            pTriangle[1].X = (xLeft * (4 - idx) + xRight * idx) / 4;
                            pTriangle[2].X = (xLeft * (3 - idx) + xRight * (idx + 1)) / 4;
                        }
                        else if (idx < 8)
                        {
                            pTriangle[1].X = pTriangle[2].X = xRight;
                            pTriangle[1].Y = (yTop * (8 - idx) + yBottom * (idx - 4)) / 4;
                            pTriangle[2].Y = (yTop * (7 - idx) + yBottom * (idx - 3)) / 4;
                        }
                        else if (idx < 12)
                        {
                            pTriangle[1].Y = pTriangle[2].Y = yBottom;
                            pTriangle[1].X = (xRight * (12 - idx) + xLeft * (idx - 8)) / 4;
                            pTriangle[2].X = (xRight * (11 - idx) + xLeft * (idx - 7)) / 4;
                        }
                        else
                        {
                            pTriangle[1].X = pTriangle[2].X = xLeft;
                            pTriangle[1].Y = (yBottom * (16 - idx) + yTop * (idx - 12)) / 4;
                            pTriangle[2].Y = (yBottom * (15 - idx) + yTop * (idx - 11)) / 4;
                        }

                        sd.ptEndCenter[idx].X = (pTriangle[0].X + pTriangle[1].X + pTriangle[2].X) / 3;
                        sd.ptEndCenter[idx].Y = (pTriangle[0].Y + pTriangle[1].Y + pTriangle[2].Y) / 3;
                    }

                    Point ptTrgCenter = new Point();

                    ptTrgCenter.X = AD.ptCenter.X;

                    ptTrgCenter.Y = AD.ptCenter.Y + (AD.ptRelRightTop.X + AD.ptRelRightTop.Y) * 4 / 5;

                    for (int idx = 0; idx < 16; idx++)
                    {
                        MATRIXF matrix;

                        matrix = MATRIXF.rotateMatrix((33 * MATRIXF.fixed1) + (-22 * MATRIXF.fixed1) * idx, AD.ptCenter);
                        sd.ptTriangleCenter[idx] = ptTrgCenter * matrix;
                        Point ptTemp = MATRIXF.subtract(sd.ptTriangleCenter[idx], sd.ptEndCenter[idx]);
                        sd.matrixCircle[idx] = MATRIXF.offsetMatrix(ptTemp.X, ptTemp.Y);
                    }

                    break;
                }                                //end case

                case AnimOperation.AnimDraw:
                case AnimOperation.AnimErase:
                {
                    Point[] ptTriangle = new Point[3];

                    double  fixedFactor;
                    MATRIXF matrix;
                    double  fxScale;

                    fxScale = MATRIXF.fixedDiv(AD.iStep, AD.iTotalSteps);

                    if (AD.iStep < AD.iTotalSteps / 2)
                    {
                        fixedFactor = (MATRIXF.fixed1 - MATRIXF.fixedDiv(AD.iStep * 2, AD.iTotalSteps)) * AD.iParameter;
                        for (int idx = 0; idx < 16; idx++)
                        {
                            matrix = MATRIXF.scaleMatrix(fxScale, fxScale, sd.ptEndCenter[idx]) *
                                     MATRIXF.rotateMatrix(fixedFactor, sd.ptEndCenter[idx]);

                            matrix = matrix * sd.matrixCircle[idx];

                            for (int iAngle = 0; iAngle < 3; iAngle++)
                            {
                                ptTriangle[iAngle] = sd.ptTriangleEnd[idx][iAngle] * matrix;
                            }

                            drawPoly(ptTriangle, AD.color);
                        }
                    }
                    else
                    {
                        fixedFactor = MATRIXF.fixedDiv(AD.iStep * 2 - AD.iTotalSteps, AD.iTotalSteps);
                        for (int idx = 0; idx < 16; idx++)
                        {
                            matrix  = MATRIXF.scaleMatrix(fxScale, fxScale, sd.ptEndCenter[idx]);
                            matrix *= MATRIXF.mix(MATRIXF.matrix1, sd.matrixCircle[idx], fixedFactor);

                            for (int iAngle = 0; iAngle < 3; iAngle++)
                            {
                                ptTriangle[iAngle] = sd.ptTriangleEnd[idx][iAngle] * matrix;
                            }

                            drawPoly(ptTriangle, AD.color);
                        }
                    }
                    break;
                }                //end case
                }                //end switch

                return(true);
            }    //end show