示例#1
0
        public static Cycle GetSample(int type, float srcWidth,
                float srcHeight, float width, float height, float offset,
                int padding)
        {
            Cycle cycle = new Cycle();
            float s = 1;
            if (srcWidth > srcHeight)
            {
                s = MathUtils.Max(srcWidth / width, srcHeight / height);
            }
            else
            {
                s = MathUtils.Min(srcWidth / width, srcHeight / height);
            }
            float scale = s;
            switch (type)
            {
                case 0:
                    cycle = new Cycle._Anonymous(scale);
                    cycle.SetLineWidth(5);
                    cycle.SetDelay(45);
                    cycle.SetColor(0xFF2E82);
                    cycle.SetStepType(4);
                    cycle.SetStepsPerFrame(1);
                    cycle.SetTrailLength(1);
                    cycle.SetPointDistance(0.05f);
                    cycle.AddPath(Cycle.ARC, 50, 50, 40, 0, 360);
                    break;
                case 1:
                    cycle.SetColor(0xFF7B24);
                    cycle.SetStepsPerFrame(1);
                    cycle.SetTrailLength(1);
                    cycle.SetPointDistance(0.10f);
                    cycle.SetMultiplier(2);
                    cycle.AddPath(Cycle.ARC, 10 * scale, 10 * scale, 10 * scale, -270,
                            -90);
                    cycle.AddPath(Cycle.BEZIER, 10 * scale, 0 * scale, 40 * scale,
                            20 * scale, 20 * scale, 0, 30 * scale, 20 * scale);
                    cycle.AddPath(Cycle.ARC, 40 * scale, 10 * scale, 10 * scale, 90,
                            -90);
                    cycle.AddPath(Cycle.BEZIER, 40 * scale, 0 * scale, 10 * scale,
                            20 * scale, 30 * scale, 0, 20 * scale, 20 * scale);
                    break;
                case 2:
                    cycle.SetColor(0xD4FF00);
                    cycle.SetStepType(1);
                    cycle.SetDelay(55);
                    cycle.SetStepsPerFrame(2);
                    cycle.SetTrailLength(0.3f);
                    cycle.SetPointDistance(0.1f);
                    cycle.AddPath(Cycle.LINE, 0, 0, 30 * scale, 0);
                    cycle.AddPath(Cycle.LINE, 30 * scale, 0 * scale, 30 * scale,
                            30 * scale);
                    cycle.AddPath(Cycle.LINE, 30 * scale, 30 * scale, 0, 30 * scale);
                    cycle.AddPath(Cycle.LINE, 0, 30 * scale, 0, 0);
                    break;
                case 3:

                    cycle = new Cycle.Anonymous_C0(scale);
                    cycle.SetColor(0x05E2FF);
                    cycle.SetLineWidth(2);
                    cycle.SetStepType(4);
                    cycle.SetStepsPerFrame(1);
                    cycle.SetTrailLength(1);
                    cycle.SetPointDistance(0.025f);
                    cycle.AddPath(Cycle.ARC, 50, 50, 40, 0, 360);
                    break;
                case 4:
                    cycle.SetColor(0xFFA50000);
                    cycle.SetStepsPerFrame(1);
                    cycle.SetTrailLength(1);
                    cycle.SetPointDistance(0.025f);
                    cycle.AddPath(Cycle.ARC, 50 * scale, 50 * scale, 40 * scale, 0, 360);
                    break;
                case 5:
                    cycle.SetColor(0xFF2E82);
                    cycle.SetDelay(60);
                    cycle.SetStepType(1);
                    cycle.SetStepsPerFrame(1);
                    cycle.SetTrailLength(1);
                    cycle.SetPointDistance(0.1f);
                    cycle.AddPath(Cycle.LINE, 0, 20 * scale, 100 * scale, 20 * scale);
                    cycle.AddPath(Cycle.LINE, 100 * scale, 20 * scale, 0, 20 * scale);
                    break;
                case 6:
                    cycle.SetStepsPerFrame(7);
                    cycle.SetTrailLength(0.7f);
                    cycle.SetPointDistance(0.01f);
                    cycle.SetDelay(35);
                    cycle.SetLineWidth(10);
                    cycle.AddPath(Cycle.LINE, 20 * scale, 70 * scale, 50 * scale,
                            20 * scale);
                    cycle.AddPath(Cycle.LINE, 50 * scale, 20 * scale, 80 * scale,
                            70 * scale);
                    cycle.AddPath(Cycle.LINE, 80 * scale, 70 * scale, 20 * scale,
                            70 * scale);
                    break;
                case 7:
                    cycle.SetColor(0xD4FF00);
                    cycle.SetStepsPerFrame(3);
                    cycle.SetTrailLength(1);
                    cycle.SetPointDistance(0.01f);
                    cycle.SetLineWidth(6);
                    cycle.SetPadding(0);
                    cycle.AddPath(Cycle.ARC, 50 * scale, 50 * scale, 20 * scale, 360, 0);
                    break;
                case 8:
                    cycle.SetColor(0x05E2FF);
                    cycle.SetStepsPerFrame(1);
                    cycle.SetTrailLength(1);
                    cycle.SetPointDistance(0.02f);
                    cycle.AddPath(Cycle.ARC, 50 * scale, 50 * scale, 30 * scale, 0, 360);
                    break;
                case 9:
                    cycle.SetStepType(1);
                    cycle.SetColor(LColor.yellow);
                    cycle.AddPath(Cycle.LINE, 10 * scale, 10 * scale, 90 * scale,
                            10 * scale);
                    cycle.AddPath(Cycle.LINE, 90 * scale, 10 * scale, 90 * scale,
                            90 * scale);
                    cycle.AddPath(Cycle.LINE, 90 * scale, 90 * scale, 10 * scale,
                            90 * scale);
                    cycle.AddPath(Cycle.LINE, 10 * scale, 90 * scale, 10 * scale,
                            10 * scale);
                    break;
            }
            float size = MathUtils.Min(srcWidth / (1 / cycle.GetPointDistance()),
                    srcHeight / (1 / cycle.GetPointDistance()));
            cycle.SetPadding(padding);
            cycle.SetBlockWidth(size + offset);
            cycle.SetBlockHeight(size + offset);
            cycle.SetWidth(width * scale);
            cycle.SetHeight(height * scale);
            return cycle;
        }
示例#2
0
文件: Cycle.cs 项目: vb0067/LGame
        public static Cycle GetSample(int type, float srcWidth,
                                      float srcHeight, float width, float height, float offset,
                                      int padding)
        {
            Cycle cycle = new Cycle();
            float s     = 1;

            if (srcWidth > srcHeight)
            {
                s = MathUtils.Max(srcWidth / width, srcHeight / height);
            }
            else
            {
                s = MathUtils.Min(srcWidth / width, srcHeight / height);
            }
            float scale = s;

            switch (type)
            {
            case 0:
                cycle = new Cycle._Anonymous(scale);
                cycle.SetLineWidth(5);
                cycle.SetDelay(45);
                cycle.SetColor(0xFF2E82);
                cycle.SetStepType(4);
                cycle.SetStepsPerFrame(1);
                cycle.SetTrailLength(1);
                cycle.SetPointDistance(0.05f);
                cycle.AddPath(Cycle.ARC, 50, 50, 40, 0, 360);
                break;

            case 1:
                cycle.SetColor(0xFF7B24);
                cycle.SetStepsPerFrame(1);
                cycle.SetTrailLength(1);
                cycle.SetPointDistance(0.10f);
                cycle.SetMultiplier(2);
                cycle.AddPath(Cycle.ARC, 10 * scale, 10 * scale, 10 * scale, -270,
                              -90);
                cycle.AddPath(Cycle.BEZIER, 10 * scale, 0 * scale, 40 * scale,
                              20 * scale, 20 * scale, 0, 30 * scale, 20 * scale);
                cycle.AddPath(Cycle.ARC, 40 * scale, 10 * scale, 10 * scale, 90,
                              -90);
                cycle.AddPath(Cycle.BEZIER, 40 * scale, 0 * scale, 10 * scale,
                              20 * scale, 30 * scale, 0, 20 * scale, 20 * scale);
                break;

            case 2:
                cycle.SetColor(0xD4FF00);
                cycle.SetStepType(1);
                cycle.SetDelay(55);
                cycle.SetStepsPerFrame(2);
                cycle.SetTrailLength(0.3f);
                cycle.SetPointDistance(0.1f);
                cycle.AddPath(Cycle.LINE, 0, 0, 30 * scale, 0);
                cycle.AddPath(Cycle.LINE, 30 * scale, 0 * scale, 30 * scale,
                              30 * scale);
                cycle.AddPath(Cycle.LINE, 30 * scale, 30 * scale, 0, 30 * scale);
                cycle.AddPath(Cycle.LINE, 0, 30 * scale, 0, 0);
                break;

            case 3:

                cycle = new Cycle.Anonymous_C0(scale);
                cycle.SetColor(0x05E2FF);
                cycle.SetLineWidth(2);
                cycle.SetStepType(4);
                cycle.SetStepsPerFrame(1);
                cycle.SetTrailLength(1);
                cycle.SetPointDistance(0.025f);
                cycle.AddPath(Cycle.ARC, 50, 50, 40, 0, 360);
                break;

            case 4:
                cycle.SetColor(0xFFA50000);
                cycle.SetStepsPerFrame(1);
                cycle.SetTrailLength(1);
                cycle.SetPointDistance(0.025f);
                cycle.AddPath(Cycle.ARC, 50 * scale, 50 * scale, 40 * scale, 0, 360);
                break;

            case 5:
                cycle.SetColor(0xFF2E82);
                cycle.SetDelay(60);
                cycle.SetStepType(1);
                cycle.SetStepsPerFrame(1);
                cycle.SetTrailLength(1);
                cycle.SetPointDistance(0.1f);
                cycle.AddPath(Cycle.LINE, 0, 20 * scale, 100 * scale, 20 * scale);
                cycle.AddPath(Cycle.LINE, 100 * scale, 20 * scale, 0, 20 * scale);
                break;

            case 6:
                cycle.SetStepsPerFrame(7);
                cycle.SetTrailLength(0.7f);
                cycle.SetPointDistance(0.01f);
                cycle.SetDelay(35);
                cycle.SetLineWidth(10);
                cycle.AddPath(Cycle.LINE, 20 * scale, 70 * scale, 50 * scale,
                              20 * scale);
                cycle.AddPath(Cycle.LINE, 50 * scale, 20 * scale, 80 * scale,
                              70 * scale);
                cycle.AddPath(Cycle.LINE, 80 * scale, 70 * scale, 20 * scale,
                              70 * scale);
                break;

            case 7:
                cycle.SetColor(0xD4FF00);
                cycle.SetStepsPerFrame(3);
                cycle.SetTrailLength(1);
                cycle.SetPointDistance(0.01f);
                cycle.SetLineWidth(6);
                cycle.SetPadding(0);
                cycle.AddPath(Cycle.ARC, 50 * scale, 50 * scale, 20 * scale, 360, 0);
                break;

            case 8:
                cycle.SetColor(0x05E2FF);
                cycle.SetStepsPerFrame(1);
                cycle.SetTrailLength(1);
                cycle.SetPointDistance(0.02f);
                cycle.AddPath(Cycle.ARC, 50 * scale, 50 * scale, 30 * scale, 0, 360);
                break;

            case 9:
                cycle.SetStepType(1);
                cycle.SetColor(LColor.yellow);
                cycle.AddPath(Cycle.LINE, 10 * scale, 10 * scale, 90 * scale,
                              10 * scale);
                cycle.AddPath(Cycle.LINE, 90 * scale, 10 * scale, 90 * scale,
                              90 * scale);
                cycle.AddPath(Cycle.LINE, 90 * scale, 90 * scale, 10 * scale,
                              90 * scale);
                cycle.AddPath(Cycle.LINE, 10 * scale, 90 * scale, 10 * scale,
                              10 * scale);
                break;
            }
            float size = MathUtils.Min(srcWidth / (1 / cycle.GetPointDistance()),
                                       srcHeight / (1 / cycle.GetPointDistance()));

            cycle.SetPadding(padding);
            cycle.SetBlockWidth(size + offset);
            cycle.SetBlockHeight(size + offset);
            cycle.SetWidth(width * scale);
            cycle.SetHeight(height * scale);
            return(cycle);
        }