コード例 #1
0
        public override void Run()
        {
            ASS ass_in  = ASS.FromFile(this.InFileName);
            ASS ass_out = new ASS();

            ass_out.Header = ass_in.Header;
            ass_out.Events = new List <ASSEvent>();

            Random rnd = new Random();

            string ptstr = @"{\p1}m 0 0 l 1 0 1 1 0 1";
            Bezier bz1   = CreateBezier3(rnd, 300, 300, 200, 100);
            Bezier bz2   = CreateBezier3(rnd, 300, 300, 200, 100);

            Bezier[] bz = new Bezier[20];
            Line[]   li = new Line[bz.Length - 1];
            Circle[] cc = new Circle[bz.Length - 1];
            for (int i = 0; i < bz.Length; i++)
            {
                bz[i] = CreateBezier3(rnd, this.PlayResX / 2, this.PlayResY / 2, this.PlayResX / 2, this.PlayResY / 2);
            }
            for (int i = 0; i < li.Length; i++)
            {
                li[i] = new Line {
                    X0 = bz[i].P3.X, Y0 = bz[i].P3.Y, X1 = bz[i + 1].P0.X, Y1 = bz[i + 1].P0.Y
                }
            }
            ;
            for (int i = 0; i < cc.Length; i++)
            {
                cc[i] = Circle.Create(bz[i].P3.X, bz[i].P3.Y, bz[i + 1].P0.X, bz[i + 1].P0.Y, Common.RandomBool(rnd, 0.5));
            }
            CompositeCurve cv = new CompositeCurve()
            {
                MinT = 0, MaxT = bz.Length + li.Length
            };

            for (int i = 0; i < li.Length; i++)
            {
                cv.AddCurve(i * 2, i * 2 + 1, bz[i]);
                cv.AddCurve(i * 2 + 1, (i + 1) * 2, cc[i]);//li[i]);
            }
            cv.AddCurve(li.Length * 2, li.Length * 2 + 1, bz[bz.Length - 1]);
            foreach (ASSPointF pt in cv.GetPath_Dis(10, 11))
            {
                ass_out.AppendEvent(0, "pt", pt.T, pt.T + 1,
                                    ASSEffect.pos(pt.X, pt.Y) + ASSEffect.a(1, "00") + ASSEffect.c(1, "FFFFFF") + ASSEffect.a(3, "FF") +
                                    ptstr);
            }

            ass_out.SaveFile(OutFileName);
        }
    }
コード例 #2
0
        public override void Run()
        {
            for (int i = 0; i < 3; i++)
            {
                ParticleIllusionExporter pie = new ParticleIllusionExporter();
                pie.Init();
                CompositeCurve curve = new CompositeCurve {
                    MinT = 0, MaxT = 10
                };
                Circle circle = new Circle {
                    MinT = 0 + (double)i * Math.PI * 2.0 / 3.0, MaxT = Math.PI * 2 * 10 + (double)i * Math.PI * 2.0 / 3.0, R = 100, X0 = 0, Y0 = 0
                };
                CompositeCurve path = new CompositeCurve {
                    MinT = 0, MaxT = 10
                };

/*                path.AddCurve(0, 2.5, new Line { X0 = 100, Y0 = 100, X1 = 500, Y1 = 100 });
 *              path.AddCurve(2.5, 5, new Line { X0 = 500, Y0 = 100, X1 = 500, Y1 = 300 });
 *              path.AddCurve(5, 7.5, new Line { X0 = 500, Y0 = 300, X1 = 100, Y1 = 300 });
 *              path.AddCurve(7.5, 10, new Line { X0 = 100, Y0 = 300, X1 = 100, Y1 = 100 });*/
                path.AddCurve(0, 10, new Circle {
                    X0 = 250, Y0 = 250, R = 130
                });
                CompoundCurve cc = new CompoundCurve {
                    MinT = 0, MaxT = 10
                };
                cc.AddCurve(0, 10, circle);
                cc.AddCurve(0, 10, path);
                curve.AddCurve(curve.MinT, curve.MaxT, cc);
                foreach (ASSPointF pt in curve.GetPath_DT(0.01))
                {
                    pie.Add(pt.T, pt);
                }
                pie.SaveToFile(@"g:\workshop\test\" + i + ".txt");
            }
        }
コード例 #3
0
        public override void Run()
        {
            ASS ass_in  = ASS.FromFile(this.InFileName);
            ASS ass_out = new ASS()
            {
                Header = ass_in.Header, Events = new List <ASSEvent>()
            };

            for (int iEv = 0; iEv < ass_in.Events.Count; iEv++)
            {
                ASSEvent        ev     = ass_in.Events[iEv];
                List <KElement> kelems = ev.SplitK(false);
                int             sw     = GetTotalWidth(ev);
                int             x0     = (PlayResX - sw) / 2;
                int             xxx    = x0;
                int             y0     = PlayResY - MarginBottom - FontHeight;
                int             kSum   = 0;
                for (int iK = 0; iK < kelems.Count; iK++)
                {
                    Console.WriteLine("{0} / {1} : {2} / {3}", iEv + 1, ass_in.Events.Count, iK + 1, kelems.Count);
                    KElement ke     = kelems[iK];
                    Size     sz     = GetSize(ke.KText);
                    double   kStart = ev.Start + kSum * 0.01;
                    double   kEnd   = kStart + ke.KValue * 0.01;
                    kSum += ke.KValue;
                    int        x     = x0 + this.FontSpace + sz.Width / 2;
                    int        y     = y0 + FontHeight / 2;
                    int        x_an7 = x0;
                    int        y_an7 = y0;
                    StringMask mask  = GetMask(ke.KText, x, y);
                    x0 += this.FontSpace + sz.Width;
                    if (ke.KText.Trim().Length == 0)
                    {
                        continue;
                    }

                    double t0 = ev.Start - 0.5 + iK * 0.05;
                    double t1 = t0 + 0.3;
                    double t2 = kStart - 0.07;
                    double t3 = kEnd;
                    double t4 = ev.End - 0.5 + iK * 0.05;
                    double t5 = t4 + 0.3;

                    Func <double, string> fMainColor = ti => (ti < t2) ? Common.scaleColor("FFFFFF", "000000", (ti - t1) / 0.2) : "FFFFFF";
                    Func <double, string> fMainAlpha = ti => (ti < t2) ? "55" : "00";

                    ass_out.AppendEvent(60, "jp", t0, t1,
                                        move(x - 100, y, x, y) + a(1, "55") + fsc(150, 150) + fad(t1 - t0, 0) +
                                        frx(Common.RandomInt(rnd, 200, 500)) +
                                        fry(Common.RandomInt(rnd, 200, 500)) +
                                        frz(Common.RandomInt(rnd, 200, 500)) +
                                        t(frx(0).t() + fry(0).t() + frz(0).t() + fsc(100, 100).t()) +
                                        ke.KText);
                    ass_out.AppendEvent(55, "jp", t2, t2 + 0.25,
                                        pos(x, y) + a(1, "00") + bord(8) + blur(8) + fad(0, 0.18) + a(3, "00") +
                                        ke.KText);
                    {
                        double ti = t1;
                        while (ti < t4)
                        {
                            double ti1 = ti + 0.04;
                            ass_out.AppendEvent(50, "jp", ti, ti1 + 0.04,
                                                pos(Common.RandomInt(rnd, x - 3, x + 3), Common.RandomInt(rnd, y - 3, y + 3)) + a(1, fMainAlpha(ti)) + fad(0, Common.RandomDouble(rnd, 0.04, 0.09)) +
                                                c(1, fMainColor(ti)) +
                                                ke.KText);
                            ti = ti1;
                        }
                        ass_out.AppendEvent(60, "jp", ti, t5,
                                            move(x, y, x + 100, y) + a(1, "00") + fad(0, t5 - ti) + c(1, "FFFFFF") +
                                            t(frx(Common.RandomInt(rnd, 200, 500)).t() + fry(Common.RandomInt(rnd, 200, 500)).t() + frz(Common.RandomInt(rnd, 200, 500)).t() + fsc(150, 150).t()) +
                                            ke.KText);
                    }

                    string cShad = "000000";
                    for (int i = 0; i < 2; i++)
                    {
                        ass_out.AppendEvent(40, "jp", t1, t4,
                                            pos(x, y) + a(1, "00") + blur(2) + c(1, cShad) +
                                            ke.KText);
                    }

                    {
                        CompositeCurve curve = new CompositeCurve {
                            MinT = t2 - 0.1, MaxT = t2 + 0.1
                        };
                        double ptag = Common.RandomDouble(rnd, 0, Math.PI);
                        double ptr  = 100;
                        double ptx0 = x + Math.Cos(ptag) * ptr;
                        double pty0 = y - Math.Sin(ptag) * ptr;
                        double ptx1 = x - Math.Cos(ptag) * ptr;
                        double pty1 = y + Math.Sin(ptag) * ptr;
                        Line   line = new Line {
                            X0 = ptx0, Y0 = pty0, X1 = ptx1, Y1 = pty1
                        };
                        curve.AddCurve(curve.MinT, curve.MaxT, line);
                        List <ASSPointF> pts = curve.GetPath_Dis(1, 1.2);
                        foreach (ASSPointF pt in pts)
                        {
                            if (!Common.InRange(0, PlayResX, pt.X) || !Common.InRange(0, PlayResY, pt.Y))
                            {
                                continue;
                            }
                            ass_out.AppendEvent(30, "pt", pt.T, pt.T + 0.25,
                                                pos(pt.X, pt.Y) + a(1, "00") + a(3, "77") + c(1, "FFD9A1") + c(3, "FFD9A1") + fad(0, 0.1) +
                                                bord(4) + blur(4) + t(bord(2).t() + blur(2).t()) +
                                                p(1) + "m 0 0 l 1 0 1 1 0 1");
                            ass_out.AppendEvent(32, "pt", pt.T, pt.T + 0.25,
                                                pos(pt.X, pt.Y) + a(1, "00") + a(3, "44") + c(1, "FFFFFF") + c(3, "FFFFFF") + fad(0, 0.1) +
                                                bord(2.5) + blur(2.5) + t(bord(1.3).t() + blur(1.3).t()) +
                                                p(1) + "m 0 0 l 1 0 1 1 0 1");
                        }
                        pts = curve.GetPath_DT(0.01);
                        foreach (ASSPointF pt in pts)
                        {
                            if (!Common.InRange(0, PlayResX, pt.X) || !Common.InRange(0, PlayResY, pt.Y))
                            {
                                continue;
                            }
                            ass_out.AppendEvent(35, "pt", pt.T, pt.T + 0.01,
                                                pos(pt.X, pt.Y) + a(1, "00") + a(3, "00") + c(1, "FFFFFF") + c(3, "FFFFFF") +
                                                bord(13) + blur(13) +
                                                p(1) + "m 0 0 l 1 0 1 1 0 1");
                        }
                    }
                }
            }

            Console.WriteLine(ass_out.Events.Count);
            ass_out.SaveFile(this.OutFileName);
        }
        public override void Run()
        {
            ASS ass_in  = ASS.FromFile(this.InFileName);
            ASS ass_out = new ASS()
            {
                Header = ass_in.Header, Events = new List <ASSEvent>()
            };

            for (int iEv = 0; iEv < ass_in.Events.Count; iEv++)
            {
                bool isJp = iEv <= 47;
                this.MaskStyle = "Style:Default,DFSoGei-W5,25,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,0,0,0,0,100,100,0,0,1,1,0,5,0,0,0,1";
                int jEv = isJp ? iEv : iEv - 48;
                //if (jEv > 0) continue;
                //if (iEv > 2) continue;
                ASSEvent         ev     = ass_in.Events[iEv];
                List <KElement>  kelems = ev.SplitK(false);
                List <ASSPointF> path   = new List <ASSPointF>();

                {
                    int totalWidth = GetTotalWidth(ev);
                    int x0         = (PlayResX - MarginRight - totalWidth - MarginLeft) / 2 + MarginLeft;
                    int y0         = (isJp) ? (PlayResY - MarginBottom - FontHeight) : MarginTop;
                    int kSum       = 0;
                    for (int iK = 0; iK < kelems.Count; iK++)
                    {
                        double sr = (double)iK / (double)(kelems.Count - 1);
                        Console.WriteLine("{0} / {1} : {2} / {3}", iEv + 1, ass_in.Events.Count, iK + 1, kelems.Count);
                        KElement ke     = kelems[iK];
                        Size     sz     = GetSize(ke.KText);
                        double   kStart = ev.Start + kSum * 0.01;
                        double   kEnd   = kStart + ke.KValue * 0.01;
                        kSum += ke.KValue;
                        int x     = x0 + this.FontSpace + sz.Width / 2;
                        int y     = y0 + FontHeight / 2;
                        int x_an7 = x0;
                        int y_an7 = y0;
                        x0 += this.FontSpace + sz.Width;
                        if (ke.KText.Trim().Length == 0)
                        {
                            continue;
                        }
                        StringMask mask    = GetMask(ke.KText, x, y);
                        string     evStyle = isJp ? "jp" : "roma";

                        path.Add(new ASSPointF {
                            X = x, Y = y, Start = kStart, End = kEnd, T = kStart
                        });

                        double t0  = ev.Start - 0.5 + iK * 0.065;
                        double t1  = t0 + 0.5;
                        double t2  = kStart;
                        double t21 = kEnd;
                        double t3  = ev.End - 0.5 + iK * 0.065;
                        double t4  = t3 + 0.5;
                        if (t21 > t3)
                        {
                            t21 = t3;
                        }

                        string MainColor = "0000A7";
                        {
                            Line line = new Line {
                                X0 = x, X1 = x, Y0 = y - 35, Y1 = y, Acc = 0.4
                            };
                            CompositeCurve curve = new CompositeCurve {
                                MinT = t0, MaxT = t1
                            };
                            curve.AddCurve(t0, t1, line);
                            foreach (ASSPointF pt in curve.GetPath_Dis(1, 1.1).OrderByDescending(xx => xx.T))
                            {
                                ass_out.AppendEvent(40, evStyle, pt.T, pt.T + 0.3,
                                                    pos(pt.X, pt.Y) + fad(0, 0.3) + a(1, "DD") + blur(1.8) + c(1, MainColor) +
                                                    a(3, "DD") + c(3, "EEEEEE") + bord(1.8) +
                                                    ke.KText);
                            }
                        }
                        {
                            Line line = new Line {
                                X0 = x, X1 = x, Y0 = y, Y1 = y + 35, Acc = 0.4
                            };
                            CompositeCurve curve = new CompositeCurve {
                                MinT = t3, MaxT = t4
                            };
                            curve.AddCurve(t3, t4, line);
                            foreach (ASSPointF pt in curve.GetPath_Dis(1, 1.1).OrderByDescending(xx => xx.T))
                            {
                                double last = 0.3 + 0.2 - Math.Abs((t4 - t3) * 0.5 + t3 - pt.T) * 1.2;
                                ass_out.AppendEvent(40, evStyle, pt.T, pt.T + last,
                                                    pos(pt.X, pt.Y) + fad(0, last) + a(1, "DD") + blur(1.8) + c(1, MainColor) +
                                                    a(3, "DD") + c(3, "EEEEEE") + bord(1.8) +
                                                    ke.KText);
                            }
                        }

                        ass_out.AppendEvent(40, evStyle, t1 - 0.1, t2,
                                            fad(0.4, 0) + pos(x + 2, y + 2) + a(1, "77") + c(1, "000000") + blur(1) +
                                            ke.KText);
                        ass_out.AppendEvent(40, evStyle, t21, t3 + 0.1,
                                            fad(0, 0.4) + pos(x + 2, y + 2) + a(1, "77") + c(1, "000000") + blur(1) +
                                            ke.KText);

                        /*
                         * ass_out.AppendEvent(50, evStyle, t1, t2,
                         *  pos(x, y) + a(1, "66") + c(1, MainColor) + blur(1) + a(3, "00") + c(3, "EEEEEE") + bord(1.8) +
                         *  ke.KText);
                         * ass_out.AppendEvent(50, evStyle, t21, t3,
                         *  pos(x, y) + a(1, "66") + c(1, MainColor) + blur(1) + a(3, "00") + c(3, "EEEEEE") + bord(1.8) +
                         *  ke.KText);
                         * */
                        {
                            Func <double, double> tempFunc = xx => Math.Sin(xx * 1.4);
                            Func <double, string> colFunc  = xx => ((tempFunc(xx) > 0) ? ASSColor.FromRGB(1, tempFunc(xx) * 255.0, 0, 255.0).ToColString() : ASSColor.FromRGB(1, 0, -tempFunc(xx) * 255.0, 255.0).ToColString());
                            string tstring = "";
                            tstring += t(0, t2 - t1, c(1, colFunc(t2)).t());
                            tstring += t(t2 - t1, t2 - t1 + 0.01, a(1, "FF").t() + a(3, "FF").t());
                            tstring += t(t21 - t1 - 0.01, t21 - t1, a(1, "66").t() + a(3, "00").t() + c(1, colFunc(t21)).t());
                            tstring += t(t21 - t1, t3 - t1, c(1, MainColor).t());
                            ass_out.AppendEvent(50, evStyle, t1, t3,
                                                pos(x, y) + a(1, "66") + c(1, MainColor) + blur(1) + a(3, "00") + c(3, "EEEEEE") + bord(1.8) +
                                                tstring +
                                                ke.KText);
                            for (double ti = t2; ti < t21 && ti < t2 + 0.2; ti += 0.01)
                            {
                                ass_out.AppendEvent(60, evStyle, ti, t21,
                                                    fad(0, t21 - ti) + pos(x, y) + a(1, "AA") + c(1, "FFFFFF") + blur(0) + a(3, "EE") + c(3, colFunc(ti)) + bord(2.5) +
                                                    t(0, 0.3, 0.6, fsc(150, 150).t()) + t(0.3, t21 - ti, blur(2.5).t() + bord(3.5).t()) +
                                                    ke.KText);
                            }
                        }
                    }
                }

                {
                    double         spd   = 750; // pixel / sec
                    double         x0    = path[0].X - 30;
                    double         y0    = path[0].Y;
                    double         t0    = path[0].T - 0.3;
                    CompositeCurve curve = new CompositeCurve {
                        MinT = ev.Start - 0.3, MaxT = ev.End
                    };
                    bool lastVertical = true;
                    int  p            = 0;
                    while (t0 < curve.MaxT)
                    {
                        double x1 = x0;
                        double y1 = y0;
                        while (p + 1 < path.Count && path[p].End <= t0)
                        {
                            p++;
                        }
                        int sig = Common.RandomSig(rnd);
                        if (lastVertical)
                        {
                            if (x0 < path[p].X)
                            {
                                sig = 1;
                            }
                            else
                            {
                                sig = -1;
                            }
                            x1 = x0 + Common.RandomDouble(rnd, 5, 50) * sig;
                        }
                        else
                        {
                            if (y0 < path[p].Y)
                            {
                                sig = 1;
                            }
                            else
                            {
                                sig = -1;
                            }
                            y1 = y0 + Common.RandomDouble(rnd, 5, 40) * sig;
                        }
                        double t1 = t0 + Common.GetDistance(x0, y0, x1, y1) / spd;
                        if (t1 >= curve.MaxT)
                        {
                            t1 = curve.MaxT;
                        }
                        curve.AddCurve(t0, t1, new Line {
                            X0 = x0, Y0 = y0, X1 = x1, Y1 = y1
                        });
                        x0           = x1;
                        y0           = y1;
                        t0           = t1;
                        lastVertical = !lastVertical;
                    }
                    foreach (ASSPointF pt in curve.GetPath_Dis(0.9, 1.0))
                    {
                        double tt  = Math.Sin(pt.T * 1.4); // DO NO CHANGE
                        string col = "";
                        if (tt > 0)
                        {
                            col = ASSColor.FromRGB(1, tt * 255.0, 0, 255.0).ToColString();
                        }
                        else
                        {
                            col = ASSColor.FromRGB(1, 0, -tt * 255.0, 255.0).ToColString();
                        }
                        ass_out.AppendEvent(20, "pt", pt.T, pt.T + 1.5,
                                            fad(0, 0.5) + pos(pt.X, pt.Y) + bord(0.8) + blur(1) +
                                            a(1, "00") + a(3, "77") + c(1, Common.scaleColor("FFFFFF", col, 0.7)) + c(3, col) +
                                            ASSEffect.p(1) + "m 0 0 l 1 0 1 1 0 1");
                    }
                }
            }

            Console.WriteLine(ass_out.Events.Count);
            ass_out.SaveFile(this.OutFileName);
        }
コード例 #5
0
        public override void Run()
        {
            ASS ass_in  = ASS.FromFile(this.InFileName);
            ASS ass_out = new ASS()
            {
                Header = ass_in.Header, Events = new List <ASSEvent>()
            };

            double[] light_time_offset = { 3.5, 3.8, 5.9, 4.9, 3.5 };
            double   light_spd         = 400;

            for (int iEv = 0; iEv < ass_in.Events.Count; iEv++)
            {
                bool isJp = iEv <= 4;
                this.MaskStyle = isJp ?
                                 "Style: Default,DFGMaruGothic-Md,38,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,0,0,0,0,100,100,0,0,1,0,0,5,0,0,0,128" :
                                 "Style: Default,方正准圆_GBK,40,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,0,0,0,0,100,100,0,0,1,0,0,5,0,0,0,1";
                this.FontHeight = isJp ? 38 : 40;
                int jEv = isJp ? iEv : iEv - 5;
                //if (!isJp) continue;
                //if (jEv > 0) continue;
                ASSEvent        ev         = ass_in.Events[iEv];
                List <KElement> kelems     = ev.SplitK(true);
                int             totalWidth = GetTotalWidth(ev);
                int             x0         = (PlayResX - MarginRight - totalWidth - MarginLeft) / 2 + MarginLeft;
                int             y0         = (isJp) ? (PlayResY - MarginBottom - FontHeight) : MarginTop;
                int             kSum       = 0;
                int             x0_start   = x0;
                int             lastx0     = 0;
                string          outlines   = "";
                for (int iK = 0; iK < kelems.Count; iK++)
                {
                    double sr = (double)iK / (double)(kelems.Count - 1);
                    Console.WriteLine("{0} / {1} : {2} / {3}", iEv + 1, ass_in.Events.Count, iK + 1, kelems.Count);
                    KElement ke     = kelems[iK];
                    Size     sz     = GetSize(ke.KText);
                    double   kStart = ev.Start + kSum * 0.01;
                    double   kEnd   = kStart + ke.KValue * 0.01;
                    kSum += ke.KValue;
                    int x     = x0 + this.FontSpace + sz.Width / 2;
                    int y     = y0 + FontHeight / 2;
                    int x_an7 = x0;
                    int y_an7 = y0;
                    x0    += this.FontSpace + sz.Width;
                    lastx0 = x0;
                    if (ke.KText.Trim().Length == 0)
                    {
                        continue;
                    }
                    StringMask mask    = GetMask(ke.KText, x, y);
                    string     evStyle = isJp ? "ed_jp" : "ed_cn";

                    if (ke.KText == "?")
                    {
                        x += 15;
                    }

                    string outlineFontname = isJp ? "DFGMaruGothic-Md" : "方正准圆_GBK";
                    int    outlineEncoding = isJp ? 128 : 1;
                    int    xoffset         = isJp ? 0 : -1;
                    if (isJp && ke.KText[0] == '中')
                    {
                        xoffset = -2;
                    }
                    string outlineString = GetOutline(x - sz.Width / 2 + xoffset, y - FontHeight / 2, ke.KText[0], outlineFontname, outlineEncoding, FontHeight, 0, 262);
                    outlines += outlineString;

                    double t0 = ev.Start - 0.5 + iK * 0.1;
                    double t1 = t0 + 0.5;
                    double t2 = kStart;
                    double t3 = t2 + 0.8;
                    double t4 = ev.End - 0.5 + iK * 0.1;
                    double t5 = t4 + 0.5;

                    string main_col  = "9699E3";
                    string main_col2 = main_col;
                    if (jEv == 0 || jEv == 1)
                    {
                        main_col  = Common.scaleColor("93CB4B", "E4B281", (sr - 0.2) / 0.8);
                        main_col2 = Common.scaleColor("E4B281", "93CB4B", (sr - 0.2) / 0.8);
                    }
                    if (jEv == 3 || jEv == 4)
                    {
                        main_col  = Common.scaleColor("9699E3", "9CCFD5", "B0CE6E", (sr - 0.2) / 0.8);
                        main_col2 = Common.scaleColor("B0CE6E", "9CCFD5", "9699E3", (sr - 0.2) / 0.8);
                    }

                    if (!isJp)
                    {
                        ass_out.AppendEvent(50, evStyle, t0, t5,
                                            pos(x, y) + a(1, "00") + c(1, main_col) + shad(1) + a(4, "33") + c(4, "FFFFFF") + a(3, "66") +
                                            fad(0.5, 0.5) + blur(2) + bord(2) +
                                            ke.KText);
                        continue;
                    }

                    double midt = (x0 - sz.Width - (x0_start - 20)) / light_spd + light_time_offset[iEv] + ev.Start - 0.6;
                    ass_out.AppendEvent(50, evStyle, t0, midt + 0.5,
                                        pos(x, y) + a(1, "00") + c(1, main_col) + shad(1) + a(4, "33") + c(4, "FFFFFF") + a(3, "66") +
                                        fad(0.5, 0.5) + blur(2) + bord(2) +
                                        ke.KText);
                    ass_out.AppendEvent(50, evStyle, midt, t5,
                                        pos(x, y) + a(1, "00") + c(1, main_col2) + shad(1) + a(4, "33") + c(4, "FFFFFF") + a(3, "66") +
                                        fad(0.5, 0.5) + blur(2) + bord(2) +
                                        ke.KText);

                    ass_out.AppendEvent(55, evStyle, t2, t3,
                                        pos(x, y) + a(1, "55") + c(1, "FFFFFF") + a(3, "55") + c(3, "FFFFFF") + blur(3) + bord(3) + fad(0, t3 - t2) +
                                        ke.KText);

                    if (iEv <= 2)
                    {
                        int tmpyy = Common.RandomInt(rnd, 0, 1);
                        for (int i = 0; i < Common.RandomInt(rnd, 1, 2); i++)
                        {
                            double ptt0 = t2 + Common.RandomDouble(rnd, 0, 0.1);
                            double ptx0 = Common.RandomDouble(rnd, x - sz.Width / 2, x + sz.Width / 2);
                            double yd   = Common.RandomDouble(rnd, 35, 50);
                            double pty0 = 0;
                            double pty1 = 0;
                            if ((tmpyy + i) % 2 == 0)
                            {
                                pty0 = y - yd;
                                pty1 = y + yd;
                            }
                            else
                            {
                                pty0 = y + yd;
                                pty1 = y - yd;
                            }
                            double spd   = 40;
                            string ptcol = (ptt0 < midt + 0.5) ? main_col : main_col2;
                            double ptt1  = ptt0 + Math.Abs(pty0 - pty1) / spd;
                            ass_out.AppendEvent(30, "pt", ptt0, ptt1,
                                                an(5) + move(ptx0, pty0, ptx0, pty1) + a(1, "00") + c(1, ptcol) +
                                                blur(5) + fs(30) + t(fsc(0, 0).t()) +
                                                '●');
                            ass_out.AppendEvent(31, "pt", ptt0, ptt1,
                                                an(5) + move(ptx0, pty0, ptx0, pty1) + a(1, "00") + c(1, Common.scaleColor("FFFFFF", ptcol, 0.7)) +
                                                blur(2.2) + fs(25) + t(fsc(0, 0).t()) +
                                                '●');
                            ass_out.AppendEvent(32, "pt", ptt0, ptt1,
                                                an(5) + move(ptx0, pty0, ptx0, pty1) + a(1, "00") +
                                                blur(1.8) + fs(12) + t(fsc(0, 0).t()) +
                                                '●');
                        }
                    }

                    if (iEv >= 3)
                    {
                        {
                            double           ptt0   = t2 - 0.4;
                            double           ptt1   = t2;
                            string           ptcol  = (ptt0 < midt + 0.5) ? main_col : main_col2;
                            double           theta1 = Common.RandomDouble(rnd, 0, Math.PI);
                            List <BaseCurve> curves = new List <BaseCurve>();
                            double           ra     = 30;
                            double           rb     = 7;
                            Circle2          cl     = new Circle2 {
                                NormTheta = false, X0 = x, Y0 = y, A = ra, B = rb, MinT = -Math.PI * 0.5, MaxT = Math.PI * 0.5, Theta = theta1, dTheta = 0
                            };
                            CompositeCurve cc = new CompositeCurve {
                                MinT = ptt0, MaxT = ptt1
                            };
                            cc.AddCurve(cc.MinT, cc.MaxT, cl);
                            curves.Add(cc);
                            cl = new Circle2 {
                                NormTheta = false, X0 = x, Y0 = y, A = ra, B = rb, MinT = -Math.PI * 0.5, MaxT = -Math.PI * 1.5, Theta = theta1, dTheta = 0
                            };
                            cc = new CompositeCurve {
                                MinT = ptt0, MaxT = ptt1
                            };
                            cc.AddCurve(cc.MinT, cc.MaxT, cl);
                            curves.Add(cc);
                            foreach (BaseCurve curve in curves)
                            {
                                foreach (ASSPointF pt in curve.GetPath_Dis(1, 1.1))
                                {
                                    ass_out.AppendEvent((pt.Theta >= 0 || pt.Theta <= -Math.PI) ? 100 : 0, "pt", pt.T, pt.T + 0.3,
                                                        an(5) + pos(pt.X, pt.Y) + a(1, "00") + c(1, "FFFFFF") + a(3, "77") + c(3, ptcol) +
                                                        bord(3) + blur(3) + fs(8) + t(fsc(0, 0).t() + bord(0).t()) +
                                                        '●');
                                }
                                foreach (ASSPointF pt in curve.GetPath_DT(0.03))
                                {
                                    ass_out.AppendEvent((pt.Theta >= 0 || pt.Theta <= -Math.PI) ? 101 : 1, "pt", pt.T, pt.T + 0.03,
                                                        an(5) + pos(pt.X, pt.Y) + a(1, "00") + c(1, "FFFFFF") +
                                                        blur(5) + fs(12) +
                                                        '●');
                                }
                            }
                            ass_out.AppendEvent(100, evStyle, ptt1, ptt1 + 0.5,
                                                pos(x, y) + a(1, "00") + a(3, "00") + bord(3) + blur(3) + fad(0, 0.3) +
                                                ke.KText);
                        }

                        for (int i = 0; i < 40; i++)
                        {
                            double ptt0  = t2 + Common.RandomDouble(rnd, 0, 0.1);
                            double ptx0  = x;
                            double pty0  = y;
                            double sc    = Common.RandomDouble(rnd, 2, 3);
                            double ptx1  = Common.RandomDouble(rnd, x - sz.Width * sc, x + sz.Width * sc);
                            double pty1  = Common.RandomDouble(rnd, y - sz.Width * sc, y + sz.Width * sc);
                            double spd   = 40;
                            string ptcol = (ptt0 < midt + 0.5) ? main_col : main_col2;
                            double ptt1  = ptt0 + Common.GetDistance(ptx0, pty0, ptx1, pty1) / spd;
                            ass_out.AppendEvent(30, "pt", ptt0, ptt1,
                                                an(5) + move(ptx0, pty0, ptx1, pty1) + a(1, "00") + c(1, ptcol) +
                                                blur(8) + fs(30) + t(fsc(0, 0).t()) +
                                                '●');
                            ass_out.AppendEvent(31, "pt", ptt0, ptt1,
                                                an(5) + move(ptx0, pty0, ptx1, pty1) + a(1, "00") + c(1, Common.scaleColor("FFFFFF", ptcol, 0.7)) +
                                                blur(2.2) + fs(25) + t(fsc(0, 0).t()) +
                                                '●');
                            ass_out.AppendEvent(32, "pt", ptt0, ptt1,
                                                an(5) + move(ptx0, pty0, ptx1, pty1) + a(1, "00") +
                                                blur(1.8) + fs(12) + t(fsc(0, 0).t()) +
                                                '●');
                        }
                    }
                }

                if (isJp)
                {
                    double ptt0 = ev.Start + light_time_offset[iEv] - 0.7;
                    double ptx0 = x0_start - 20;
                    double ptx1 = lastx0 + 20;
                    double ptt1 = ptt0 + (ptx1 - ptx0) / light_spd;
                    ass_out.AppendEvent(100, "pt", ptt0, ptt1,
                                        clip(4, outlines) + move(ptx0, y0 + FontHeight / 2, ptx1, y0 + FontHeight / 2) +
                                        a(1, "55") + frz(-45) + blur(8) + fscx(200) +
                                        p(1) + "m 10 -50 l 10 50 -10 50 -10 -50");
                }
            }

            Console.WriteLine(ass_out.Events.Count);
            ass_out.SaveFile(this.OutFileName);
        }
コード例 #6
0
        public override void Run()
        {
            ASS ass_in  = ASS.FromFile(this.InFileName);
            ASS ass_out = new ASS();

            ass_out.Header = ass_in.Header;
            ass_out.Events = new List <ASSEvent>();

            Random rnd = new Random();

            string col0   = "96726A";
            string col1   = "D17C6A";
            string ptcol2 = "644BFF";
            string ptcol1 = "5BFF4B";
            string ptstr  = @"{\p1}m 0 0 l 1 0 1 1 0 1";

            string[] ptcollist =
            {
                "5A3AFF",
                "3A5BFF",
                "FF3A5D",
                "3AFF4E",
                "FF3AD9",
                "FFD13A"
            };
            string lastptcol = "";

            string[] firestr =
            {
                @"{\p5}m 0 0 b 8 1 9 -28 -2 -41 b 3 -23 -17 0 0 0",
                @"{\p5}m 1 41 b 20 39 1 13 13 -11 b 5 1 -18 22 1 41",
                @"{\p4}m 6 39 b 4 29 1 13 27 -37 b -1 -3 -15 34 6 39",
                @"{\p5}m -3 43 b -9 22 -1 33 16 -47 b 1 3 -17 0 -3 43"
            };

            string spstr = @"{\p1}m 3 0 b 7 0 12 0 16 0 b 19 0 19 2 16 2 b 12 2 7 2 3 2 b 0 2 0 0 3 0{\p0}";

            for (int iEv = 0; iEv < ass_in.Events.Count; iEv++)
            {
                //if (iEv > 0) continue;
                ASSEvent        ev     = ass_in.Events[iEv];
                List <KElement> kelems = ev.SplitK(false);

                int x0      = MarginLeft;
                int startx0 = x0;
                int y0      = PlayResY - MarginBottom - FontHeight;
                int kSum    = 0;

                List <ASSPointF> poslist = new List <ASSPointF>();

                string ptcol = ptcollist[Common.RandomInt(rnd, 0, ptcollist.Length - 1)];
                while (ptcol == lastptcol)
                {
                    ptcol = ptcollist[Common.RandomInt(rnd, 0, ptcollist.Length - 1)];
                }
                lastptcol = ptcol;

                for (int iK = 0; iK < kelems.Count; iK++)
                {
                    Console.WriteLine("{0} / {1} : {2} / {3}", iEv + 1, ass_in.Events.Count, iK + 1, kelems.Count);
                    KElement ke     = kelems[iK];
                    double   r      = (double)iK / (double)(kelems.Count - 1);
                    Size     sz     = GetSize(ke.KText);
                    double   kStart = ev.Start + kSum * 0.01;
                    double   kEnd   = kStart + ke.KValue * 0.01;
                    kSum += ke.KValue;
                    int        x    = x0 + this.FontSpace + sz.Width / 2;
                    int        y    = y0 + FontHeight / 2;
                    StringMask mask = GetMask(ke.KText, x, y);
                    x0 += this.FontSpace + sz.Width;
                    y0  = y0;
                    if (ke.KText.Trim().Length == 0)
                    {
                        continue;
                    }
                    poslist.Add(new ASSPointF {
                        X = x, Y = y, Start = kStart, End = kEnd
                    });

                    double t0 = ev.Start - 0.5 + iK * 0.05;
                    double t1 = t0 + 0.3;
                    double t2 = kStart;
                    double t3 = kEnd;
                    double t4 = ev.End - 0.5 + iK * 0.05;
                    double t5 = t4 + 0.3;

                    ass_out.AppendEvent(60, "Default", t0, t1,
                                        pos(x, y) + frz(-30) + a(1, "00") +
                                        fad((t1 - t0) * 0.5, 0) + fsc(130, 200) + blur(3) + bord(0) +
                                        t(0, t1 - t0, frz(0).t() + fsc(100, 100).t() + c(1, col0).t() + blur(0).t()) +
                                        ke.KText);
                    ass_out.AppendEvent(50, "Default", t1, t2,
                                        pos(x, y) + a(1, "00") + c(1, col0) +
                                        ke.KText);
                    ass_out.AppendEvent(60, "Default", t2, t3,
                                        pos(x, y) + a(1, "00") + a(3, "00") + c(3, col1) +
                                        bord(4) + blur(4) + fsc(200, 200) +
                                        t(0, t3 - t2, fsc(110, 110).t() + bord(2).t() + blur(2).t()) +
                                        ke.KText);
                    ass_out.AppendEvent(30, "Default", t2, t4,
                                        pos(x, y) + a(1, "FF") + a(3, "44") +
                                        bord(2) + blur(2) +
                                        fad(0.3, 0.1) +
                                        ke.KText);
                    ass_out.AppendEvent(50, "Default", t3, t4,
                                        pos(x, y) + a(1, "00") + c(1, "FFFFFF") + a(3, "00") +
                                        c(3, col1) + bord(1) +
                                        ke.KText);
                    ass_out.AppendEvent(40, "Default", t4, t5,
                                        pos(x, y) + a(1, "00") + c(1, "FFFFFF") + a(3, "FF") +
                                        bord(0) + blur(0) + fad(0, t5 - t4) +
                                        t(0, t5 - t4, frz(30).t() + fsc(130, 200).t() + blur(4).t()) +
                                        ke.KText);

                    //continue;
                    for (int i = 0; i < (t2 - t1) * 100; i++)
                    {
                        ASSPoint pt     = mask.Points[Common.RandomInt(rnd, 0, mask.Points.Count - 1)];
                        double   ptx    = pt.X;
                        double   pty    = pt.Y;
                        double   ptt0   = Common.RandomDouble(rnd, t1, t2);
                        double   ptt1   = ptt0 + 0.3;
                        int      tmpz   = Common.RandomInt(rnd, 0, 359);
                        string   tmpstr = firestr[Common.RandomInt(rnd, 0, firestr.Length - 1)];
                        ass_out.AppendEvent(100, "pt", ptt0, ptt1,
                                            move(ptx, pty, ptx, pty - 20) + a(1, "D0") + c(1, "B79E8A") +
                                            a(3, "C0") + c(3, "B79E8A") + bord(3) + blur(3) +
                                            frz(tmpz) +
                                            t(0, ptt1 - ptt0, fsc(80, 80).t() + bord(1).t() + frx(0).t() + fry(361).t() + frz(-57).t()) +
                                            tmpstr);
                    }
                    for (int i = 0; i < (t4 - t3) * 100; i++)
                    {
                        ASSPoint pt     = mask.Points[Common.RandomInt(rnd, 0, mask.Points.Count - 1)];
                        double   ptx    = pt.X;
                        double   pty    = pt.Y;
                        double   ptt0   = Common.RandomDouble(rnd, t3, t4);
                        double   ptt1   = ptt0 + 0.3;
                        int      tmpz   = Common.RandomInt(rnd, 0, 359);
                        string   tmpstr = firestr[Common.RandomInt(rnd, 0, firestr.Length - 1)];
                        ass_out.AppendEvent(100, "pt", ptt0, ptt1,
                                            move(ptx, pty, ptx, pty - 20) + a(1, "D0") + c(1, "3D3EE7") + //354CB9
                                            a(3, "C0") + c(3, "3D3EE7") + bord(3) + blur(3) +
                                            frz(tmpz) +
                                            t(0, ptt1 - ptt0, fsc(80, 80).t() + bord(1).t() + frx(0).t() + fry(361).t() + frz(-57).t()) +
                                            tmpstr);
                    }
                }

                //continue;

                for (int i = 1; i < poslist.Count; i++)
                {
                    if (poslist[i].End - poslist[i].Start < 1e-8)
                    {
                        poslist[i - 1].End -= 0.1;
                        poslist[i].Start   -= 0.1;
                    }
                }

                for (int i = 0; i < 3; i++)
                {
                    /*
                     * if (i > 1) continue;
                     * CompositeCurve curve = new CompositeCurve() { MinT = ev.Start - 0.1, MaxT = ev.End + (PlayResX - x0) * 0.002 };
                     * bool lastup = i == 0;
                     * if (lastup)
                     *  curve.AddCurve(curve.MinT, ev.Start, new Line() { MinT = 0, MaxT = 1, X0 = 0, X1 = MarginLeft, Y0 = y0 - FontHeight * 0.5, Y1 = y0 - FontHeight * 0.5 });
                     * else
                     *  curve.AddCurve(curve.MinT, ev.Start, new Line() { MinT = 0, MaxT = 1, X0 = 0, X1 = MarginLeft, Y0 = y0 + FontHeight * 1.5, Y1 = y0 + FontHeight * 1.5 });
                     * string ptcol = lastup ? ptcol1 : ptcol2;
                     * double lastx1 = MarginLeft;
                     * double lasty1 = 0;
                     * double lastt = 0;
                     * foreach (ASSPointF pos in poslist)
                     * {
                     *  double thisx1 = pos.X + FontWidth / 2;
                     *  double yy0 = y0 - FontHeight * 0.5;
                     *  double yy1 = y0 + FontHeight * 1.5;
                     *  if (!lastup)
                     *  {
                     *      yy0 = y0 + FontHeight * 1.5;
                     *      yy1 = y0 - FontHeight * 0.5;
                     *  }
                     *  lastup = !lastup;
                     *  //curve.AddCurve(pos.Start, pos.End, new Line() { MinT = 0, MaxT = 1, X0 = lastx1, X1 = thisx1, Y0 = yy0, Y1 = yy1 });
                     *  curve.AddCurve(pos.Start, pos.End, Sine.Create(lastx1, yy0, thisx1, yy1));
                     *  lastx1 = thisx1;
                     *  lasty1 = yy1;
                     *  lastt = pos.End;
                     * }
                     * curve.AddCurve(lastt, curve.MaxT, new Line() { MinT = 0, MaxT = 1, X0 = lastx1, X1 = PlayResX, Y0 = lasty1, Y1 = lasty1 });
                     * */
                    CompoundCurve curve = new CompoundCurve()
                    {
                        MinT = ev.Start - 0.2, MaxT = ev.End + 1
                    };
                    curve.AddCurve(curve.MinT, curve.MaxT, new Circle()
                    {
                        X0 = 0, Y0 = 0, R = 30, MinT = 0 + i * 2.0 / 3.0 * Math.PI, MaxT = Math.PI * 2 * (curve.MaxT - curve.MinT) * 1.3 + i * 2.0 / 3.0 * Math.PI
                    });
                    CompositeCurve pathcurve = new CompositeCurve()
                    {
                        MinT = curve.MinT, MaxT = curve.MaxT
                    };
                    double lastx = 0;
                    double lastt = curve.MinT;
                    double yyy   = y0 + FontHeight * 0.5;
                    for (int j = 0; j < poslist.Count; j++)
                    {
                        double thist = poslist[j].Start;
                        double thisx = poslist[j].X;
                        pathcurve.AddCurve(lastt, thist, new Line()
                        {
                            X0 = lastx, X1 = thisx, Y0 = yyy, Y1 = yyy
                        });
                        if (j + 1 == poslist.Count)
                        {
                            thist = curve.MaxT;
                        }
                        else
                        {
                            thist = poslist[j + 1].Start - 0.2;
                            if (thist < poslist[j].Start)
                            {
                                thist = poslist[j].Start * 0.25 + poslist[j + 1].Start * 0.75;
                            }
                        }
                        pathcurve.AddCurve(poslist[j].Start, thist, new Line()
                        {
                            X0 = thisx, X1 = thisx, Y0 = yyy, Y1 = yyy
                        });
                        lastt = thist;
                        lastx = thisx;
                    }
                    curve.AddCurve(curve.MinT, curve.MaxT, pathcurve);

                    List <ASSPointF> pts = curve.GetPath_Dis(1, 1.2);
                    foreach (ASSPointF pt in pts)
                    {
                        double ptx2 = Common.RandomDouble(rnd, pt.X - 10, pt.X - 15);
                        double pty2 = pt.Y * 0.25 + (y0 + FontHeight * 0.5) * 0.75;
                        ass_out.AppendEvent(55, "pt", pt.T, pt.T + 0.3,
                                            pos(pt.X, pt.Y) +
                                            //                          move(pt.X, pt.Y, ptx2, pty2, 0.4, 1) +
                                            a(1, "AA") + c(1, "FFFFFF") +
                                            a(3, "AA") + c(3, ptcol) +
                                            bord(6) + blur(6) +
                                            t(0, 0.1, bord(3).t() + blur(3).t()) +
                                            fad(0, 0.2) +
                                            ptstr);
                        ass_out.AppendEvent(55, "pt", pt.T, pt.T + 0.3,
                                            pos(pt.X, pt.Y) +
//                            move(pt.X, pt.Y, ptx2, pty2, 0.4, 1) +
                                            a(1, "AA") + c(1, "FFFFFF") +
                                            a(3, "00") + c(3, "FFFFFF") +
                                            bord(4) + blur(4) +
                                            t(0, 0.1, bord(1).t() + blur(1).t() + a(3, "44").t()) +
                                            fad(0, 0.2) +
                                            ptstr);
                    }
                }
            }

            ass_out.SaveFile(OutFileName);
            Console.WriteLine("Lines : {0}", ass_out.Events.Count);
        }
コード例 #7
0
        public override void Run()
        {
            string ptstr = @"{\p1}m 0 0 l 1 0 1 1 0 1";

            ASS ass_in  = ASS.FromFile(this.InFileName);
            ASS ass_out = new ASS();

            ass_out.Header = ass_in.Header;
            ass_out.Events = new List <ASSEvent>();

            forceCurve = new CompositeCurve {
                MinT = 0, MaxT = 30
            };
            double lastag = 0;

            for (double time = forceCurve.MinT; time <= forceCurve.MaxT; time += 1)
            {
                double ag = Common.RandomDouble(rnd, 0, Math.PI * 2);
                while (Math.Abs(ag - lastag) < Math.PI * 0.5 || Math.Abs(ag - lastag) > Math.PI * 1.5)
                {
                    ag = Common.RandomDouble(rnd, 0, Math.PI * 2);
                }
                lastag = ag;
                //ag = 0;
                double x = 1000.0 * Math.Cos(ag);
                double y = 600.0 * Math.Sin(ag);
                forceCurve.AddCurve(time, time + 1, new Line {
                    X0 = x, Y0 = y, X1 = 0, Y1 = 0, Acc = 0.7
                });
                //forceCurve.AddCurve(time, time + 1, new Line { X0 = 0, Y0 = 0, X1 = 0, Y1 = 0 });
            }

            NumberPerSecond = 100;
            XXParticleSystem xxps = new XXParticleSystem();

            xxps.Emitter                = this;
            xxps.ForceField             = this;
            xxps.StartTime              = 0;
            xxps.EndTime                = 3;
            xxps.InterpolationPrecision = 0.04;
            xxps.Resistance             = 0.03;
            xxps.Repulsion              = -2200;
            xxps.Gravity                = 0;
            xxps.GravityPosition        = this;
            List <KeyValuePair <XXParticleElement, List <ASSPointF> > > result = xxps.RenderPoint();

            foreach (KeyValuePair <XXParticleElement, List <ASSPointF> > pair in result)
            {
                string s = CreatePolygon(rnd, 5, 10, 6);
                foreach (ASSPointF pt in pair.Value)
                {
                    ass_out.AppendEvent(0, "pt", pt.T, pt.T + xxps.InterpolationPrecision,
                                        pos(pt.X, pt.Y) + a(1, "22") + a(3, "77") + blur(2) + bord(1.5) + c(3, "532BFF") +
                                        s);
                    continue;
                    ass_out.AppendEvent(0, "pt", pt.T, pt.T + xxps.InterpolationPrecision,
                                        pos(pt.X, pt.Y) + a(1, "00") +
                                        ptstr);
                    continue;
                    ASSPointF force = forceCurve.GetPointF(pt.T);
                    ass_out.AppendEvent(0, "pt", pt.T, pt.T + xxps.InterpolationPrecision,
                                        pos(0, 0) + an(7) + a(1, "00") + fs(16) +
                                        string.Format("{0}, {1}", force.X, force.Y));
                }
            }

            ass_out.SaveFile(OutFileName);
        }
コード例 #8
0
        public override void Run()
        {
            ASS ass_in  = ASS.FromFile(this.InFileName);
            ASS ass_out = new ASS()
            {
                Header = ass_in.Header, Events = new List <ASSEvent>()
            };

            for (int iEv = 0; iEv < ass_in.Events.Count; iEv++)
            {
                bool isJp = iEv <= 9;
                //if (iEv != 0) continue;
                //if (iEv != 9) continue;
                //if (!isJp) continue;
                //if (iEv != 5 && iEv != 6) continue;
                //if (iEv != 19 && iEv != 9) continue;
                //if (iEv < 20) continue;
                ASSEvent        ev     = ass_in.Events[iEv];
                List <KElement> kelems = ev.SplitK(!isJp);
                int             x0     = MarginLeft;
                int             y0     = (isJp || iEv >= 20) ? (PlayResY - MarginBottom - FontHeight) : MarginTop;
                int             kSum   = 0;

                /// 两句英文
                if (iEv >= 20)
                {
                    y0            -= 45;
                    x0            += 4;
                    this.MaskStyle = "Style: Default,DFMincho-UB,30,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,0,0,0,0,100,100,0,0,0,0,0,5,0,0,0,128";
                    for (int iK = 0; iK < kelems.Count; iK++)
                    {
                        Console.WriteLine("{0} / {1} : {2} / {3}", iEv + 1, ass_in.Events.Count, iK + 1, kelems.Count);
                        KElement ke     = kelems[iK];
                        Size     sz     = GetSize(ke.KText);
                        double   kStart = ev.Start + kSum * 0.01;
                        double   kEnd   = kStart + ke.KValue * 0.01;
                        kSum += ke.KValue;
                        int        x     = x0 + this.FontSpace + sz.Width / 2;
                        int        y     = y0 + FontHeight / 2;
                        int        x_an7 = x0 + 2;
                        int        y_an7 = y0;
                        StringMask mask  = GetMask(ke.KText, x, y);
                        x0 += this.FontSpace + sz.Width;
                        if (ke.KText.Trim().Length == 0)
                        {
                            x0 -= sz.Width / 2;
                        }
                        if (ke.KText.Trim().Length == 0)
                        {
                            continue;
                        }

                        double t0 = ev.Start - 0.5 + iK * 0.07;
                        double t1 = t0 + 0.35;
                        double t2 = kStart;
                        double t3 = kEnd;
                        double t4 = ev.End - 0.5 + iK * 0.07;
                        double t5 = t4 + 0.35;

                        Func <double, double> fPosX = h => (x + (h - ev.Start) * 20);

                        ass_out.AppendEvent(50, "en", t0, t4,
                                            move(fPosX(t0), y, fPosX(t4), y) + a(1, "00") +
                                            fsc(0, 0) + fad(0.1, 0) +
                                            t(0, 0.28, fsc(140, 140).t()) + t(0.28, 0.35, fsc(100, 100).t()) +
                                            ke.KText);
                        ass_out.AppendEvent(30, "en", t0, t4,
                                            fsc(0, 0) + fad(0.1, 0) +
                                            t(0, 0.28, fsc(140, 140).t()) + t(0.28, 0.35, fsc(100, 100).t()) +
                                            move(fPosX(t0), y, fPosX(t4), y) + a(3, "44") + bord(3) + blur(3) + c(3, "6888FF") +
                                            ke.KText);
                        ass_out.AppendEvent(50, "en", t4, t5,
                                            move(fPosX(t4), y, fPosX(t5), y) + a(1, "00") +
                                            fad(0, 0.1) +
                                            t(0, 0.07, fsc(140, 140).t()) + t(0.07, 0.35, fsc(0, 0).t()) +
                                            ke.KText);
                        ass_out.AppendEvent(30, "en", t4, t5,
                                            fad(0, 0.1) +
                                            t(0, 0.07, fsc(140, 140).t()) + t(0.07, 0.35, fsc(0, 0).t()) +
                                            move(fPosX(t4), y, fPosX(t5), y) + a(3, "44") + bord(3) + blur(3) + c(3, "6888FF") +
                                            ke.KText);

                        string ptcol = "FF68AD";
                        for (int i = 0; i < 50; i++)
                        {
                            double ptx0 = Common.RandomDouble_Gauss(rnd, x - 2, x + 2);
                            double pty0 = Common.RandomDouble_Gauss(rnd, y - 2, y + 2);
                            double ptag = Common.RandomDouble(rnd, 0, Math.PI * 2);
                            double ptr  = Common.RandomDouble_Gauss(rnd, 50, 75);
                            double ptx1 = ptx0 + Math.Cos(ptag) * ptr;
                            double pty1 = pty0 + Math.Sin(ptag) * ptr;
                            double ptt0 = Common.RandomDouble(rnd, t0, t0 + 0.2);
                            double ptt1 = ptt0 + Common.RandomDouble(rnd, 2, 3);

                            string tstr = "";
                            for (double tmpt = 0; tmpt <= ptt1 - ptt0; tmpt += 0.40)
                            {
                                tstr += t(tmpt, tmpt + 0.20, a(1, "FF").t() + a(3, "FF").t()) + t(tmpt + 0.20, tmpt + 0.40, a(1, "44").t() + a(3, "88").t());
                            }
                            ass_out.AppendEvent(0, "pt", ptt0, ptt1,
                                                move(ptx0, pty0, ptx1, pty1) + a(1, "44") + a(3, "88") + c(3, Common.RandomBool(rnd, 0.5) ? ptcol : "FFFFFF") +
                                                bord(1.5) + blur(1.5) + fsc(150, 150) + tstr +
                                                p(1) + "m 0 0 l 1 0 1 1 0 1");
                        }
                    }
                    continue;
                }

                for (int iK = 0; iK < kelems.Count; iK++)
                {
                    Console.WriteLine("{0} / {1} : {2} / {3}", iEv + 1, ass_in.Events.Count, iK + 1, kelems.Count);
                    if (iEv == 19)
                    {
                        isJp = iK <= 10;
                    }
                    this.MaskStyle = isJp ?
                                     "Style: Default,DFMincho-UB,38,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,0,0,0,0,100,100,0,0,0,0,0,5,0,0,0,128" :
                                     "Style: Default,汉仪粗宋繁,38,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,1,0,0,0,100,100,0,0,0,0,0,5,0,0,0,134";
                    string evStyle         = isJp ? "" : "cn";
                    string outlineFontname = isJp ? "DFMincho-UB" : "汉仪粗宋繁";
                    int    outlineEncoding = isJp ? 128 : 134;
                    isJp = iEv <= 9;
                    KElement ke = kelems[iK];
                    Size     sz = GetSize(ke.KText);
                    if (ke.KText[0] == 'く')
                    {
                        x0 += 2;
                    }
                    double kStart = ev.Start + kSum * 0.01;
                    double kEnd   = kStart + ke.KValue * 0.01;
                    kSum += ke.KValue;
                    int        x     = x0 + this.FontSpace + sz.Width / 2;
                    int        y     = y0 + FontHeight / 2;
                    int        x_an7 = x0 + 2;
                    int        y_an7 = y0;
                    StringMask mask  = GetMask(ke.KText, x, y);
                    x0 += this.FontSpace + sz.Width;
                    if (ke.KText.Trim().Length == 0)
                    {
                        continue;
                    }
                    string outlineString = GetOutline(x - FontHeight / 2, y - FontHeight / 2, ke.KText[0], outlineFontname, outlineEncoding, 38, 0, 262);

                    if (iEv == 9 && iK == 0)
                    {
                        outlineString = GetOutline(x - FontHeight / 2 + 10, y - FontHeight / 2, 'I', outlineFontname, outlineEncoding, 38, 0, 262);
                    }
                    if (iEv == 9 && iK == 2)
                    {
                        outlineString =
                            GetOutline(x - FontHeight / 2 - 29, y - FontHeight / 2, 'w', outlineFontname, outlineEncoding, 38, 0, 262) +
                            GetOutline(x - FontHeight / 2 - 29 + 30 - 12 + 1, y - FontHeight / 2, 'a', outlineFontname, outlineEncoding, 38, 0, 262) +
                            GetOutline(x - FontHeight / 2 - 29 + 60 - 20 - 2, y - FontHeight / 2, 'n', outlineFontname, outlineEncoding, 38, 0, 262) +
                            GetOutline(x - FontHeight / 2 - 29 + 90 - 34, y - FontHeight / 2, 'n', outlineFontname, outlineEncoding, 38, 0, 262) +
                            GetOutline(x - FontHeight / 2 - 29 + 120 - 44, y - FontHeight / 2, 'a', outlineFontname, outlineEncoding, 38, 0, 262);
                    }
                    if (iEv == 9 && iK == 4)
                    {
                        outlineString =
                            GetOutline(x - FontHeight / 2 - 29 - 11 + 30, y - FontHeight / 2, 's', outlineFontname, outlineEncoding, 38, 0, 262) +
                            GetOutline(x - FontHeight / 2 - 29 + 30 - 12 + 1 + 20, y - FontHeight / 2, 'a', outlineFontname, outlineEncoding, 38, 0, 262) +
                            GetOutline(x - FontHeight / 2 - 29 + 60 - 20 - 2 + 19, y - FontHeight / 2, 'y', outlineFontname, outlineEncoding, 38, 0, 262);
                    }

                    if (iEv == 19 && iK <= 10)
                    {
                        outlineString = GetOutline(x - FontHeight / 2 + 8, y - FontHeight / 2, ke.KText[0], outlineFontname, outlineEncoding, 38, 0, 262);
                    }

                    if (!isJp)
                    {
                        y += 2;
                    }

                    double t0 = ev.Start - 0.5 + iK * 0.07;
                    double t1 = t0 + 0.5;
                    double t2 = kStart;
                    double t3 = kEnd;
                    double t4 = ev.End - 0.6 + iK * 0.07;
                    double t5 = t4 + 0.5;

                    int lumsz = 12;
                    if (iEv == 9 && iK == 2)
                    {
                        lumsz = 18;
                    }
                    if (iEv == 1 || iEv == 2)
                    {
                        lumsz = 15;
                    }
                    ASSPointF[] lums = new ASSPointF[1];
                    for (int i = 0; i < lums.Length; i++)
                    {
                        lums[i] = new ASSPointF {
                            X = Common.RandomDouble(rnd, x_an7 - 2, x0), Y = Common.RandomDouble(rnd, y - 18, y + 18)
                        }
                    }
                    ;
                    string[] lumcols   = { "002BC8" };
                    string[] lumalphas = { "00" };

                    string shadCol1 = "000000";
                    if (!isJp)
                    {
                        shadCol1 = "FFFFFF";
                    }
                    string shadCol2 = "FFFFFF";

                    string lightCol = "6888FF";

                    if (isJp)
                    {
                        ass_out.AppendEvent(50, evStyle, t2 - 0.15, t3 - 0.15,
                                            pos(x + 1, y + 2) + fad(0.1, Common.Min(0.3, t3 - t2 - 0.2)) + fsc(150, 150) + t(fsc(100, 100).t()) +
                                            a(1, "00") + a(3, "66") + c(3, lumcols[0]) + bord(3) + blur(3) +
                                            ke.KText);
                        ass_out.AppendEvent(8, evStyle, t0, t2 + 0.8,
                                            pos(x + 2, y + 2) + fad(0.8, 0.8) +
                                            a(1, "77") + c(1, shadCol1) + blur(2) +
                                            ke.KText);
                        ass_out.AppendEvent(8, evStyle, t2, t5 - 0.5,
                                            pos(x + 2, y + 2) + fad(0.8, 0.8) +
                                            a(1, "00") + c(1, shadCol2) + blur(2) +
                                            ke.KText);
                    }
                    else
                    {
                        ass_out.AppendEvent(8, evStyle, t0, t5 - 0.5,
                                            pos(x + 2, y + 2) + fad(0.8, 0.8) +
                                            a(1, "00") + c(1, shadCol1) + blur(2) +
                                            ke.KText);
                    }

                    for (int iLum = 0; iLum < lums.Length; iLum++)
                    {
                        string col1   = lumcols[iLum];
                        double lum1_x = lums[iLum].X;
                        double lum1_y = lums[iLum].Y;
                        for (int i = 0; i < 2; i++)
                        {
                            ass_out.AppendEvent(20, "pt", t0, t1,
                                                an(5) +
                                                clip(4, outlineString) + pos(lum1_x, lum1_y) +
                                                a(1, lumalphas[iLum]) + a(3, "00") + c(1, col1) + c(3, col1) +
                                                t(bord(lumsz).t() + blur(lumsz).t()) +
                                                @"{\p1}m 0 0 l 1 0 1 1 0 1");
                            ass_out.AppendEvent(20, "pt", t1, t4,
                                                an(5) +
                                                clip(4, outlineString) + pos(lum1_x, lum1_y) +
                                                a(1, lumalphas[iLum]) + a(3, "00") + c(1, col1) + c(3, col1) +
                                                blur(lumsz) + bord(lumsz) +
                                                @"{\p1}m 0 0 l 1 0 1 1 0 1");
                            ass_out.AppendEvent(20, "pt", t4, t5,
                                                an(5) +
                                                clip(4, outlineString) + pos(lum1_x, lum1_y) +
                                                a(1, lumalphas[iLum]) + a(3, "00") + c(1, col1) + c(3, col1) +
                                                blur(lumsz) + bord(lumsz) +
                                                t(bord(0).t() + blur(0).t()) +
                                                @"{\p1}m 0 0 l 1 0 1 1 0 1");
                        }
                    }

                    if (!isJp)
                    {
                        continue;
                    }

                    /*if (iEv == 9)
                     * {
                     *  string strikeCol = "FF68AD";
                     *  for (int j = 0; j < 40; j++)
                     *  {
                     *      for (int i = 0; i < 20; i++)
                     *      {
                     *          double ptt0 = t2 - 0.3 + i * 0.01;
                     *          double ptt1 = ptt0 + 0.3;
                     *          string ptCol1 = Common.scaleColor(strikeCol, "FFFFFF", 1 - (double)i / 19.0 * 0.5);
                     *          string ptAlpha = "77";
                     *          if (i >= 17) ptAlpha = "00";
                     *          int ag1 = j * 9 + (int)(((double)i * 0.01) * 360);
                     *          int ag2 = ag1 + 360;
                     *          ass_out.AppendEvent(0 + i / 2, "pt", ptt0, ptt1,
                     *              move(x + 50, y, x + 50, y - 50) + org(x, y) + blur(2.3 - i * 0.07) + a(1, ptAlpha) + a(3, ptAlpha) + frz(-ag1) +
                     *              c(1, ptCol1) + c(3, ptCol1) + t(0, 0.1, fscx(250 - 10 * i).t()) + fscy(100 - i * 5) + t(frz(-ag2).t()) +
                     *              p(3) + "m 100 0 b 20 10 -20 10 -100 0 -20 -10 20 -10 100 0");
                     *      }
                     *  }
                     * }*/
                    if (iEv == 0)
                    {
                        foreach (ASSPoint pt in mask.Points)
                        {
                            double ag  = (double)(pt.Y - mask.Y0) / (double)mask.Height * 0.25;
                            int    iag = (int)(ag / Math.PI / 2 * 360);
                            ass_out.AppendEvent(70, "pt", t2 - 0.2, t5,
                                                pos(pt.X, pt.Y) + frz(iag) + t(fry(180).t()) + fad(0.1, 0.5) +
                                                a(1, "F4") + c(1, lightCol) + be(1) +
                                                @"{\p2}m 0 0 l -200 0 0 2");
                        }
                    }
                    if (iEv == 1 || iEv == 2)
                    {
                        double ptt0 = t2 - 0.2;
                        double ptt1 = t3 - 0.2;
                        double ptt2 = t3 + 2;
                        if (ptt2 > t4)
                        {
                            ptt2 = t4;
                        }
                        ass_out.AppendEvent(5, "pt", ptt0, ptt2,
                                            pos(x, y) + an(5) + blur(2) + bord(2) + fad(0.3, 0.5) +
                                            a(1, "00") + c(1, "FFFFFF") + fsc(50, 50) +
                                            t(0, 0.01, fsc(130, 130).t()) +
                                            t(ptt1 - ptt0 - 0.3, ptt1 - ptt0, fsc(70, 70).t() + a(1, "AA").t()) +
                                            a(3, "44") + c(3, "FF68AD") + t(frz((int)((ptt2 - ptt0) * ((((iEv + iK) % 2 == 1) ? 100 : -100)))).t()) +
                                            p(2) + "m 64 14 b 66 10 67 5 66 1 b 59 0 50 0 46 2 b 45 6 47 10 48 15 b 42 15 37 17 32 21 b 31 18 27 13 24 11 b 18 15 14 20 10 25 b 13 29 17 31 21 32 b 17 38 14 43 14 49 b 10 47 5 46 1 47 b 0 53 0 60 1 67 b 5 68 10 66 14 64 b 15 70 17 76 20 81 b 17 83 13 85 10 88 b 13 94 18 98 25 103 b 27 101 31 96 32 92 b 36 95 42 98 48 99 b 47 103 46 107 46 112 b 53 113 59 113 66 112 b 66 107 66 104 64 99 b 70 98 75 95 81 92 b 81 95 84 100 88 103 b 93 100 99 94 102 88 b 99 85 95 83 92 81 b 95 76 97 70 98 65 b 103 66 106 68 111 67 b 113 60 113 55 111 47 b 107 46 103 48 98 49 b 97 44 95 38 92 32 b 95 31 100 29 102 25 b 98 19 94 15 88 11 b 85 13 82 18 81 21 b 76 18 70 15 64 14 l 55 37 b 68 38 75 45 76 57 b 76 68 68 76 56 77 b 44 75 37 68 36 57 b 37 45 44 38 55 37 l 59 37 l 66 15 l 64 14");
                    }
                    if (iEv == 3 || iEv == 4)
                    {
                        string strikeCol = "FF68AD";
                        if (iEv == 3)
                        {
                            for (int i = 0; i < 20; i++)
                            {
                                double ptt0    = t2 - 0.3 + i * 0.01;
                                double ptt1    = ptt0 + 0.3;
                                string ptCol1  = Common.scaleColor(strikeCol, "FFFFFF", (double)i / 19.0 * 0.8);
                                string ptCol2  = Common.scaleColor(strikeCol, "FFFFFF", (double)i / 19.0 * 0.5);
                                string ptAlpha = "77";
                                if (i >= 17)
                                {
                                    ptAlpha = "00";
                                }
                                ass_out.AppendEvent(15, "pt", ptt0, ptt1,
                                                    pos(x, y) + blur(2.3 - i * 0.07) + a(1, ptAlpha) + a(3, ptAlpha) + frz(90) +
                                                    c(1, ptCol1) + c(3, ptCol1) + t(0, 0.1, fscx(500 - 20 * i).t()) + fscy(100 - i * 5) +
                                                    p(3) + "m 100 0 b 20 10 -20 10 -100 0 -20 -10 20 -10 100 0");
                            }
                        }
                        else if (iEv == 4)
                        {
                            for (int j = 0; j < 4; j++)
                            {
                                if ((iEv + iK + (j / 2)) % 2 == 0)
                                {
                                    continue;
                                }
                                string ptStr = "m 100 0 b 20 10 -20 10 -100 0 -20 -10 20 -10 100 0";
                                if (j >= 2)
                                {
                                    ptStr = "m 0 -100 b 10 -20 10 20 0 100 -10 20 -10 -20 0 -100";
                                }
                                Func <double, ASSPointF> fpos = ti => new ASSPointF();
                                if (j == 2)
                                {
                                    fpos = ti => new ASSPointF {
                                        X = x - 20, Y = y + ti * 200
                                    }
                                }
                                ;
                                else if (j == 3)
                                {
                                    fpos = ti => new ASSPointF {
                                        X = x + 20, Y = y - ti * 200
                                    }
                                }
                                ;
                                else if (j == 0)
                                {
                                    fpos = ti => new ASSPointF {
                                        X = x + ti * 200, Y = y - 20
                                    }
                                }
                                ;
                                else if (j == 1)
                                {
                                    fpos = ti => new ASSPointF {
                                        X = x - ti * 200, Y = y + 20
                                    }
                                }
                                ;
                                for (int i = 0; i < 20; i++)
                                {
                                    double ptt0    = t2 - 0.3 + i * 0.01;
                                    double ptt1    = ptt0 + 0.3;
                                    string ptCol1  = Common.scaleColor(strikeCol, "FFFFFF", (double)i / 19.0 * 0.8);
                                    string ptCol2  = Common.scaleColor(strikeCol, "FFFFFF", (double)i / 19.0 * 0.5);
                                    string ptAlpha = "77";
                                    if (i >= 17)
                                    {
                                        ptAlpha = "00";
                                    }
                                    ass_out.AppendEvent(15, "pt", ptt0, ptt1,
                                                        move(fpos(ptt0 - t2 + 0.3 - 0.3), fpos(ptt1 - t2 + 0.3)) + blur(2.3 - i * 0.07) + a(1, ptAlpha) + a(3, ptAlpha) +
                                                        c(1, ptCol1) + c(3, ptCol1) + ((j <= 1) ? (t(0, 0.1, fscx(500 - 20 * i).t()) + fscy(100 - i * 5)) : (t(0, 0.1, fscy(500 - 20 * i).t()) + fscx(100 - i * 5))) +
                                                        p(3) + ptStr);
                                }
                            }
                        }
                        {
                            double ptt0 = t2 - 0.2;
                            double ptt1 = t3 - 0.2;
                            double ptt2 = t3 + 2;
                            if (ptt2 > t4)
                            {
                                ptt2 = t4;
                            }
                            ass_out.AppendEvent(5, "pt", ptt0, ptt2,
                                                pos(x, y + 15) + an(5) + blur(2) + bord(2) + fad(0.3, 0.5) +
                                                a(1, "00") + c(1, "FFFFFF") + fsc(50, 50) + frx(60) +
                                                t(0, 0.01, fsc(130, 130).t()) +
                                                t(ptt1 - ptt0 - 0.3, ptt1 - ptt0, fsc(70, 70).t() + a(1, "77").t()) +
                                                a(3, "44") + c(3, "FF68AD") + t(frz((int)((ptt2 - ptt0) * ((((iEv + iK) % 2 == 1) ? 100 : -100)))).t()) +
                                                p(2) + "m 64 14 b 66 10 67 5 66 1 b 59 0 50 0 46 2 b 45 6 47 10 48 15 b 42 15 37 17 32 21 b 31 18 27 13 24 11 b 18 15 14 20 10 25 b 13 29 17 31 21 32 b 17 38 14 43 14 49 b 10 47 5 46 1 47 b 0 53 0 60 1 67 b 5 68 10 66 14 64 b 15 70 17 76 20 81 b 17 83 13 85 10 88 b 13 94 18 98 25 103 b 27 101 31 96 32 92 b 36 95 42 98 48 99 b 47 103 46 107 46 112 b 53 113 59 113 66 112 b 66 107 66 104 64 99 b 70 98 75 95 81 92 b 81 95 84 100 88 103 b 93 100 99 94 102 88 b 99 85 95 83 92 81 b 95 76 97 70 98 65 b 103 66 106 68 111 67 b 113 60 113 55 111 47 b 107 46 103 48 98 49 b 97 44 95 38 92 32 b 95 31 100 29 102 25 b 98 19 94 15 88 11 b 85 13 82 18 81 21 b 76 18 70 15 64 14 l 55 37 b 68 38 75 45 76 57 b 76 68 68 76 56 77 b 44 75 37 68 36 57 b 37 45 44 38 55 37 l 59 37 l 66 15 l 64 14");
                        }
                    }
                    if (iEv >= 5 && iEv <= 9)
                    {
                        string strikeCol = "FF68AD";
                        double ptt0      = t2 - 0.3;
                        double ptt1      = t3 - 0.2 - 0.1;
                        if (ptt1 > t4)
                        {
                            ptt1 = t4;
                        }
                        double           theta1 = Common.RandomDouble(rnd, 0, Math.PI);
                        List <BaseCurve> curves = new List <BaseCurve>();
                        Circle2          cl     = new Circle2 {
                            X0 = x, Y0 = y, A = 60, B = 27, MinT = 0 + ptt0 * 4, MaxT = (ptt1 - ptt0) * Math.PI * 2 + ptt0 * 4, Theta = theta1, dTheta = 0
                        };
                        CompositeCurve cc = new CompositeCurve {
                            MinT = ptt0, MaxT = ptt1
                        };
                        cc.AddCurve(cc.MinT, cc.MaxT, cl);
                        curves.Add(cc);
                        cl = new Circle2 {
                            X0 = x, Y0 = y, A = 60, B = 27, MinT = 0 + ptt0 * 4 + Math.PI, MaxT = Math.PI + (ptt1 - ptt0) * Math.PI * 2 + ptt0 * 4, Theta = theta1, dTheta = 0
                        };
                        cc = new CompositeCurve {
                            MinT = ptt0, MaxT = ptt1
                        };
                        cc.AddCurve(cc.MinT, cc.MaxT, cl);
                        curves.Add(cc);
                        for (int i = 0; i < curves.Count; i++)
                        {
                            BaseCurve        curve      = curves[i];
                            List <ASSPointF> path       = curve.GetPath_Dis(6, 7);
                            string           strikeCol2 = Common.scaleColor(strikeCol, "FFFFFF", 0.5);
                            foreach (ASSPointF pt in path)
                            {
                                ass_out.AppendEvent((pt.Theta < Math.PI) ? 0 : 100, "pt", pt.T, pt.T + 0.3,
                                                    pos(pt.X, pt.Y) + a(1, "44") + a(3, "77") + c(1, "FFFFFF") + c(3, "FFFFFF") +
                                                    bord(8) + blur(8) +
                                                    t(0, 0.04, c(1, strikeCol2).t() + c(3, strikeCol2).t() + bord(4).t() + blur(4).t()) +
                                                    t(0.04, 0.3, c(1, strikeCol).t() + c(3, strikeCol).t() + bord(2).t() + blur(2).t()) +
                                                    p(1) + "m 0 0 l 1 0 1 1 0 1");
                                ass_out.AppendEvent((pt.Theta < Math.PI) ? 0 : 100, "pt", pt.T, pt.T + 0.3,
                                                    pos(pt.X, pt.Y) + a(1, "44") + a(3, "44") + c(1, "FFFFFF") + c(3, "FFFFFF") +
                                                    bord(4) + blur(4) +
                                                    t(0, 0.04, bord(2.5).t() + blur(2.5).t()) +
                                                    t(0.04, 0.3, bord(1.3).t() + blur(1.3).t()) +
                                                    p(1) + "m 0 0 l 1 0 1 1 0 1");
                            }
                        }
                        for (int j = 0; j < 10; j++)
                        {
                            double             dz    = Common.RandomDouble(rnd, -30, 30);
                            Func <double, int> fz    = ti => (int)((theta1 + Math.PI * 0.5) / Math.PI / 2.0 * 360.0 + dz * (ptt1 - ti) / (ptt1 - ptt0));
                            string             ptStr = "m 100 0 b 20 10 -20 10 -100 0 -20 -10 20 -10 100 0";
                            for (int i = 0; i < 20; i++)
                            {
                                double pttt0   = ptt0 + i * 0.01;
                                double pttt1   = ptt1;
                                string ptCol1  = Common.scaleColor(strikeCol, "FFFFFF", (double)i / 19.0 * 0.8);
                                string ptCol2  = Common.scaleColor(strikeCol, "FFFFFF", (double)i / 19.0 * 0.5);
                                string ptAlpha = "77";
                                if (i >= 17)
                                {
                                    ptAlpha = "00";
                                }
                                ass_out.AppendEvent(0 + i, "pt", pttt0, pttt1,
                                                    fad(0, 0.5) + pos(x, y) + blur(2.3 - i * 0.07) + a(1, ptAlpha) + a(3, ptAlpha) + frz(fz(pttt0)) +
                                                    c(1, ptCol1) + c(3, ptCol1) + t(0, 0.1, fscx(500 - 20 * i).t()) + fscy(100 - i * 5) + t(0, (pttt1 - pttt0) * 0.9, frz(fz(pttt1)).t()) +
                                                    p(3) + ptStr);
                            }
                        }
                    }
                }
            }

            Console.WriteLine(ass_out.Events.Count);
            ass_out.SaveFile(this.OutFileName);
        }
    }
}
コード例 #9
0
        public override void Run()
        {
            ASS ass_in  = ASS.FromFile(this.InFileName);
            ASS ass_out = new ASS()
            {
                Header = ass_in.Header, Events = new List <ASSEvent>()
            };

            for (int iEv = 0; iEv < ass_in.Events.Count; iEv++)
            {
                bool isJp = iEv <= 6;
                //if (!isJp || iEv < 4 || iEv > 4) continue;
                this.MaskStyle = isJp ?
                                 "Style: Default,DFMincho-UB,38,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,0,0,0,0,100,100,0,0,0,0,0,5,0,0,0,128" :
                                 "Style: Default,汉仪粗宋繁,38,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,1,0,0,0,100,100,0,0,0,0,0,5,0,0,0,134";
                ASSEvent        ev     = ass_in.Events[iEv];
                List <KElement> kelems = ev.SplitK(!isJp);
                int             x0     = MarginLeft;
                if ((isJp && iEv >= 4) || (!isJp && iEv - 7 >= 4))
                {
                    x0 = PlayResX - MarginRight - GetTotalWidth(ev);
                }
                int y0   = (isJp) ? (PlayResY - MarginBottom - FontHeight) : MarginTop;
                int kSum = 0;

                List <KeyValuePair <double, ASSPoint> > textpath = new List <KeyValuePair <double, ASSPoint> >();

                for (int iK = 0; iK < kelems.Count; iK++)
                {
                    //if (iK > 0) break;
                    Console.WriteLine("{0} / {1} : {2} / {3}", iEv + 1, ass_in.Events.Count, iK + 1, kelems.Count);
                    string   evStyle         = isJp ? "jp" : "cn";
                    string   outlineFontname = isJp ? "DFMincho-UB" : "汉仪粗宋繁";
                    int      outlineEncoding = isJp ? 128 : 134;
                    KElement ke = kelems[iK];
                    Size     sz = GetSize(ke.KText);
                    if (ke.KText[0] == 'く')
                    {
                        x0 += 2;
                    }
                    double kStart = ev.Start + kSum * 0.01;
                    double kEnd   = kStart + ke.KValue * 0.01;
                    kSum += ke.KValue;
                    int        x     = x0 + this.FontSpace + sz.Width / 2;
                    int        y     = y0 + FontHeight / 2;
                    int        x_an7 = x0 + 2;
                    int        y_an7 = y0;
                    StringMask mask  = GetMask(ke.KText, x, y);
                    x0 += this.FontSpace + sz.Width;
                    if (ke.KText.Trim().Length == 0)
                    {
                        continue;
                    }
                    string outlineString = GetOutline(x - FontHeight / 2, y - FontHeight / 2, ke.KText[0], outlineFontname, outlineEncoding, 38, 0, 262);

                    if (!isJp)
                    {
                        y += 2;
                    }

                    textpath.Add(new KeyValuePair <double, ASSPoint>(kStart, new ASSPoint {
                        X = x, Y = y, Start = kStart, End = kEnd
                    }));

                    double t0 = ev.Start - 0.5 + iK * 0.07;
                    double t1 = t0 + 0.5;
                    double t2 = kStart;
                    double t3 = kEnd;
                    double t4 = ev.End - 0.6 + iK * 0.07;
                    double t5 = t4 + 0.5;

                    {
                        string red = "1A037C";
                        red = "3B1FB6";
                        string aoi = "9D3653";

                        string scol = iEv <= 1 ? red : aoi;
                        if (iEv >= 4)
                        {
                            scol = red;
                        }

                        if (isJp)
                        {
                            ass_out.AppendEvent(51, "pt", t2, t2 + 1,
                                                pos(0, 0) + fad(0, 0.9) +
                                                a(1, "00") + a(3, "77") + blur(5) + bord(5) + t(bord(0).t()) +
                                                p(4) + outlineString);
                        }
                        ass_out.AppendEvent(40, "pt", t0, t5,
                                            pos(1, 1) + fad(0.5, 0.5) +
                                            a(1, "00") + blur(1.3) + c(1, "000000") +
                                            p(4) + outlineString);

                        if (true)
                        {
                            double lastptx0 = 0;
                            double lastpty0 = 0;
                            bool   first    = true;

                            for (double ti = t0 - 1 + Common.RandomDouble(rnd, -0.3, 0.3); ti <= t5 - 1.5; ti += Common.RandomDouble(rnd, 1.2, 1.65))
                            {
                                double ptt0 = ti;
                                double ptt1 = ptt0 + 3;
                                double ptx0 = Common.RandomDouble(rnd, x - 20, x + 20);
                                double pty0 = Common.RandomDouble(rnd, y - 20, y + 20);

                                if (!first)
                                {
                                    for (int i = 0; i < 2; i++)
                                    {
                                        double ptx0_tmp = Common.RandomDouble(rnd, x - 20, x + 20);
                                        double pty0_tmp = Common.RandomDouble(rnd, y - 20, y + 20);
                                        if (Common.GetDistance(lastptx0, lastpty0, ptx0, pty0) < Common.GetDistance(lastptx0, lastpty0, ptx0_tmp, pty0_tmp))
                                        {
                                            ptx0 = ptx0_tmp;
                                            pty0 = pty0_tmp;
                                        }
                                    }
                                }
                                first    = false;
                                lastptx0 = ptx0;
                                lastpty0 = pty0;

                                string ptcol = "FFFFFF";
                                double lumsz = 15 + Common.GetDistance(x, y, ptx0, pty0) * 0.5;
                                if (ptt0 >= kStart - 1 && ptt0 <= kEnd - 1)
                                {
                                    lumsz += 0;
                                }
                                //if (iEv <= 3)
                                if (isJp)
                                {
                                    if (ptt0 >= t2)
                                    {
                                        ptcol = scol;
                                    }
                                }

                                string ts0 = "";
                                //if (iEv <= 3)
                                if (isJp)
                                {
                                    if (ptt0 < t2 && ptt1 > t2)
                                    {
                                        ts0 = t(t2 - ptt0 - 0.01, t2 - ptt0, c(1, scol).t() + c(3, scol).t());
                                    }
                                }

                                int dup = 1;
                                if ((isJp && iEv >= 4) || (!isJp && iEv - 7 >= 4))
                                {
                                    dup = 2;
                                }

                                while (dup-- > 0)
                                {
                                    ass_out.AppendEvent(50, "pt", ptt0, ptt1,
                                                        pos(ptx0, pty0) + clip(4, outlineString) + org(x, y) + t(frz(Common.RandomSig(rnd) * Common.RandomInt(rnd, 80, 120)).t()) +
                                                        fad(0.8, 0.8) + t(0, ptt1 - ptt0, bord(lumsz).t() + blur(lumsz).t()) +
                                                        a(1, "44") + a(3, "44") + c(1, ptcol) + c(3, ptcol) +
                                                        ts0 +
                                                        t((ptt1 - ptt0) * 0.7, ptt1, c(1, "000000").t() + c(3, "000000").t()) +
                                                        p(1) + "m 0 0 l 1 0 1 1 0 1");
                                }
                            }
                        }
                    }

                    if (!isJp)
                    {
                        continue;
                    }

                    if (iEv <= 3)
                    {
                        for (int i = 0; i < (kEnd - kStart) * 7; i++)
                        {
                            double ptx0 = Common.RandomDouble(rnd, x - 20, x + 20);
                            double pty0 = Common.RandomDouble(rnd, y - 5, y + 20);
                            double ptx1 = Common.RandomDouble(rnd, ptx0 - 150, ptx0 - 250);
                            double pty1 = Common.RandomDouble(rnd, pty0 - 30, pty0 - 80);
                            double ptt0 = Common.RandomDouble(rnd, kStart, kEnd) - 0.3;
                            double ptt1 = ptt0 + 5;

                            double posx = 0, posy = 0;
                            if (ptx0 < 0 || ptx1 < 0)
                            {
                                posx  = Math.Min(ptx0, ptx1);
                                ptx0 -= posx;
                                ptx1 -= posx;
                            }
                            if (pty0 < 0 || pty1 < 0)
                            {
                                posy  = Math.Min(pty0, pty1);
                                pty0 -= posy;
                                pty1 -= posy;
                            }
                            string moveStringX  = fscx((int)(ptx0 * 100)) + t(0, 5, 3, fscx((int)(ptx1 * 100)).t());
                            string moveStringY  = fscy((int)(pty0 * 100)) + t(0, 5, 0.6, fscy((int)(pty1 * 100)).t());
                            string splashString = "";
                            for (double ti = 0; ti <= ptt1 - ptt0; ti += 0.8)
                            {
                                splashString += t(ti + 0, ti + 0.4, a(1, "FF").t() + a(3, "FF").t()) + t(ti + 0.4, ti + 0.8, a(1, "22").t() + a(3, "44").t());
                            }

                            string ptstr  = @"{\p1}m 0 0 l 1 0 1 1 0 1";
                            string par    = CreatePolygon(rnd, 5, 10, 6);
                            string parcol = "EC3667";
                            if (iEv <= 1)
                            {
                                parcol = "532BFF";
                            }

                            for (int j = 0; j < 1; j++)
                            {
                                ass_out.AppendEvent(12, "pt", ptt0 + j * 0.1, ptt1 + j * 0.1,
                                                    pos(posx, posy) +
                                                    moveStringY +
                                                    ptstr + "\\N" + r() +
                                                    moveStringX +
                                                    ptstr + r() +
                                                    fad(0, 0.5) + pos(0, 0) +
                                                    a(1, "22") + a(3, "44") + blur(1.5) + bord(1.5) + c(3, parcol) +
                                                    splashString +
                                                    par);
                            }
                        }
                    }
                }

                if (!isJp)
                {
                    continue;
                }

                //continue;

                if (iEv >= 4)
                {
                    for (int i = 0; i < textpath.Count - 1; i++)
                    {
                        if (textpath[i].Value.End < textpath[i + 1].Value.Start)
                        {
                            textpath[i].Value.End = textpath[i + 1].Value.Start;
                        }
                    }
                    textpath[textpath.Count - 1].Value.End = ev.End;

                    emitterList = new List <ASSPointF>();
                    foreach (KeyValuePair <double, ASSPoint> pair in textpath)
                    {
                        emitterList.Add(new ASSPointF
                        {
                            Start = pair.Value.Start,
                            End   = pair.Value.End,
                            X     = pair.Value.X + Common.RandomDouble(rnd, -20, 20),
                            Y     = pair.Value.Y + Common.RandomDouble(rnd, -20, 20)
                        });
                    }

                    forceCurve = new CompositeCurve {
                        MinT = ev.Start, MaxT = ev.End + 10
                    };
                    double lastag = 0;
                    for (double time = forceCurve.MinT; time <= forceCurve.MaxT; time += 0.7)
                    {
                        double ag = Common.RandomDouble(rnd, 0, Math.PI * 2);
                        while (Math.Abs(ag - lastag) < Math.PI * 0.5 || Math.Abs(ag - lastag) > Math.PI * 1.5)
                        {
                            ag = Common.RandomDouble(rnd, 0, Math.PI * 2);
                        }
                        lastag = ag;
                        double x = 1500.0 * Math.Cos(ag);
                        double y = 800.0 * Math.Sin(ag);
                        forceCurve.AddCurve(time, time + 0.7, new Line {
                            X0 = x, Y0 = y, X1 = 0, Y1 = 0, Acc = 0.7
                        });
                    }

                    NumberPerSecond = 90;
                    XXParticleSystem xxps = new XXParticleSystem();
                    xxps.Emitter                = this;
                    xxps.ForceField             = this;
                    xxps.StartTime              = ev.Start;
                    xxps.EndTime                = ev.End;
                    xxps.InterpolationPrecision = 0.03;
                    xxps.Resistance             = 0.04;
                    xxps.Repulsion              = -3600;
                    xxps.Gravity                = 0;
                    xxps.GravityPosition        = this;

                    xxps.InterpolationPrecision = 0.01;
                    List <KeyValuePair <XXParticleElement, List <string> > > result = xxps.RenderT();
                    foreach (KeyValuePair <XXParticleElement, List <string> > pair in result)
                    {
                        string s     = CreatePolygon(rnd, 12, 12, 4);
                        string ptstr = @"{\p1}m 0 0 l 1 0 1 1 0 1";
                        string ptcol = "532BFF";
                        ass_out.AppendEvent(100, "pt", pair.Key.Born, pair.Key.Born + pair.Key.Life,
                                            pos(-100, -100) +
                                            pair.Value[1] +
                                            ptstr + "\\N" + r() +
                                            pair.Value[0] +
                                            ptstr + r() +
                                            a(1, "22") + a(3, "77") + blur(2.5) + bord(2) + c(3, ptcol) +
                                            s);
                    }

                    /*
                     * List<KeyValuePair<XXParticleElement, List<ASSPointF>>> result = xxps.RenderPoint();
                     * foreach (KeyValuePair<XXParticleElement, List<ASSPointF>> pair in result)
                     * {
                     *  string s = CreatePolygon(rnd, 12, 12, 4);
                     *  foreach (ASSPointF pt in pair.Value)
                     *  {
                     *      pt.T -= 0.3;
                     *      string ptcol = "532BFF";
                     *      ass_out.AppendEvent(100, "pt", pt.T, pt.T + xxps.InterpolationPrecision,
                     *          pos(pt.X, pt.Y) + a(1, "22") + a(3, "77") + blur(2.5) + bord(2) + c(3, ptcol) +
                     *          s);
                     *  }
                     * }
                     * */
                }
            }

            Console.WriteLine(ass_out.Events.Count);
            ass_out.SaveFile(this.OutFileName);
        }
コード例 #10
0
        public override void Run()
        {
            ASS ass_in  = ASS.FromFile(this.InFileName);
            ASS ass_out = new ASS()
            {
                Header = ass_in.Header, Events = new List <ASSEvent>()
            };

            for (int iEv = 0; iEv < ass_in.Events.Count; iEv++)
            {
                bool isJp = iEv <= 13;
                //if (isJp) continue;
                //if (iEv != 5 && iEv != 6) continue;
                ASSEvent        ev     = ass_in.Events[iEv];
                List <KElement> kelems = ev.SplitK(true);
                int             x0     = MarginLeft;
                if (!isJp)
                {
                    int totalWidth = 0;
                    foreach (KElement ke in kelems)
                    {
                        this.MaskStyle = "Style: Default,宋体,40,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,0,0,0,0,100,100,0,0,0,0,0,7,0,0,0,0";
                        string outlineFontname = isJp ? "DFGMaruMoji-SL" : "華康少女文字W5(P)";
                        int    outlineEncoding = isJp ? 128 : 136;
                        int    yoffset         = 279;
                        int    ox_offset       = 0;
                        string outlineString   = GetOutline(10, 10, ke.KText[0], outlineFontname, outlineEncoding, FontHeight, 0, yoffset);
                        Size   sz = GetMask(p(4) + outlineString, 0, 0).GetSize();
                        if (ke.KText.Trim().Length == 0)
                        {
                            sz.Width = this.FontHeight;
                        }
                        totalWidth += sz.Width + FontSpace;
                    }
                    x0 = PlayResX - MarginRight - totalWidth;
                }
                int    bakx0      = x0;
                int    y0         = (!isJp) ? (PlayResY - MarginBottom - FontHeight) : MarginTop;
                int    kSum       = 0;
                string outlines   = "";
                double lastKStart = -1;
                double lastx0     = 0;
                double lastt0     = 0;
                for (int iK = 0; iK < kelems.Count; iK++)
                {
                    if (iK == 15)
                    {
                        int asfasd = 2;
                    }
                    Console.WriteLine("{0} / {1} : {2} / {3}", iEv + 1, ass_in.Events.Count, iK + 1, kelems.Count);
                    KElement ke = kelems[iK];

                    /*this.MaskStyle = isJp ?
                     *  "Style: Default,DFGMaruMoji-SL,40,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,0,0,0,0,100,100,0,0,0,0,0,5,0,0,0,128" :
                     *  "Style: Default,方正准圆_GBK,40,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,0,0,0,0,100,100,0,0,0,0,0,5,0,0,0,134";*/
                    this.MaskStyle = "Style: Default,宋体,40,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,0,0,0,0,100,100,0,0,0,0,0,7,0,0,0,0";
                    string outlineFontname = isJp ? "DFGMaruMoji-SL" : "華康少女文字W5(P)";
                    int    outlineEncoding = isJp ? 128 : 136;
                    int    yoffset         = 279;
                    int    ox_offset       = 0;
                    string outlineString   = "";
                    Size   sz = new Size();
                    if (ke.KText.Trim().Length == 0)
                    {
                        sz = new Size {
                            Width = FontHeight, Height = FontHeight
                        };
                    }
                    else
                    {
                        outlineString = GetOutline(10, 10, ke.KText[0], outlineFontname, outlineEncoding, FontHeight, 0, yoffset);
                        sz            = GetMask(p(4) + outlineString, 0, 0).GetSize();
                    }
                    double kStart = ev.Start + kSum * 0.01;
                    if (ke.IsSplit)
                    {
                        if (lastKStart >= 0)
                        {
                            kStart = lastKStart;
                        }
                        else
                        {
                            lastKStart = kStart;
                        }
                    }
                    else
                    {
                        lastKStart = -1;
                    }
                    double kEnd = kStart + ke.KValue * 0.01;
                    kSum += ke.KValue;
                    int x     = x0 + this.FontSpace + sz.Width / 2;
                    int y     = y0 + FontHeight / 2;
                    int x_an7 = x0;
                    int y_an7 = y0;
                    x0    += this.FontSpace + sz.Width;
                    lastx0 = x0;
                    if (ke.KText.Trim().Length == 0)
                    {
                        continue;
                    }
                    if (!isJp)
                    {
                        if (ke.KText == "(")
                        {
                            x -= 19;
                        }
                        if (ke.KText == ")")
                        {
                            x -= 2;
                        }
                        if (ke.KText == "!")
                        {
                            x -= 10;
                        }
                    }
                    outlineString = GetOutline(ox_offset + x - sz.Width / 2, y - FontHeight / 2, ke.KText[0], outlineFontname, outlineEncoding, FontHeight, 0, yoffset);
                    outlines     += outlineString;
                    double perc = (double)iK / (double)(kelems.Count - 1);

                    double t0 = ev.Start - 0.5 + iK * 0.04;
                    lastt0 = t0;
                    double t1 = t0 + 0.3;
                    double t2 = kStart - 0.02;
                    double t3 = t2 + 0.4;
                    double t4 = ev.End - 0.5 + iK * 0.04;
                    //t3 = (t4 - t2) * (1 - (1 - perc) * 0.25) + t2;
                    if (t3 > t4)
                    {
                        t3 = t4;
                    }
                    double t5 = t4 + 0.3;

                    if (!isJp)
                    {
                        t2 = ev.Start + (x0 - bakx0) / 600.0 + 0.3;
                    }

                    string mainColor   = Common.scaleColor("3F40FF", "3F68FF", perc);
                    string shadowColor = Common.scaleColor("3F40FF", "3F68FF", 1 - perc);

                    for (int i = -4; i <= 4; i++)
                    {
                        ass_out.AppendEvent(70, "pt", t0, t1,
                                            move(0 + i * 5, 0, 0, 0) + fad(0.15, 0) + a(1, "DD") + a(3, "DD") + c(1, mainColor) +
                                            ybord(0) + xbord(10 + Math.Abs(i) * 1) + blur(8 + Math.Abs(i) * 1) +
                                            t(bord(2).t() + blur(0).t()) +
                                            p(4) + outlineString);
                    }
                    ass_out.AppendEvent(49, "pt", t1 - 0.3, t4,
                                        pos(0, 0) + a(1, "FF") + a(3, "00") + c(3, shadowColor) + bord(5) + blur(5) + fad(0.3, 0) +
                                        p(4) + outlineString);
                    if (isJp)
                    {
                        ass_out.AppendEvent(70, "pt", t2, t3,
                                            pos(0, 0) + a(1, "00") + a(3, "00") + c(3, mainColor) + bord(2) + fad(0, t3 - t2) +
                                            p(4) + outlineString);
                        ass_out.AppendEvent(69, "pt", t2, t3,
                                            pos(0, 0) + a(1, "FF") + a(3, "00") + bord(8) + fad(0, t3 - t2) + blur(8) +
                                            p(4) + outlineString);
                    }
                    ass_out.AppendEvent(50, "pt", t1, t4,
                                        pos(0, 0) + fad(0.3, 0) + a(1, "00") + a(3, "00") + c(1, mainColor) + bord(2) +
                                        p(4) + outlineString);

                    //if (isJp)
                    {
                        double dt = 1.7;
                        for (double ptt0 = t2; ptt0 < t4; ptt0 += dt)
                        {
                            double fadeout = 0.5;
                            double fadein  = 0.5;
                            if (ptt0 == t2)
                            {
                                fadein = 0.2;
                            }
                            double ptt1 = ptt0 + dt;
                            if (ptt1 > t4)
                            {
                                ptt1    = t4;
                                fadeout = 0.2;
                            }
                            string s  = "";
                            double r1 = 40;
                            double r2 = 40;
                            for (int i = 0; i < 20; i++)
                            {
                                double ag  = Common.RandomDouble(rnd, 0, 2 * Math.PI);
                                double ptx = Math.Cos(ag) * r1;
                                double pty = Math.Sin(ag) * r2;
                                if (i == 0)
                                {
                                    s += "m";
                                }
                                if (i == 1)
                                {
                                    s += " l";
                                }
                                s += string.Format(" {0} {1}", (int)ptx, (int)pty);
                            }
                            ass_out.AppendEvent(80, "pt", ptt0 - fadein, ptt1 + fadeout,
                                                clip(4, outlineString) + pos(x + 5, y) + org(x, y) + a(1, "22") + fad(fadein, fadeout) +
                                                t(frz((int)((ptt0 - ptt1) * 360 / dt)).t()) + blur(3) +
                                                p(1) + s);
                        }
                    }

                    for (int i = 0; i < 10; i++)
                    {
                        string moveString = move(0, 0, 0 - 100, 0);
                        if (iEv == 2 || iEv == 4)
                        {
                            moveString = move(0, 0, 0, 0 + 100);
                        }
                        if (iEv == 5 || iEv == 6)
                        {
                            moveString = move(0, 0, 0, 0 + 100);
                        }
                        ass_out.AppendEvent(60 - i, "pt", t4 + i * 0.01, t5 + i * 0.01,
                                            moveString + fad(0, 0.2) + a(1, "00") + a(3, "77") + c(1, mainColor) + bord(2) +
                                            t(blur(5).t()) + t(0, 0.05, a(1, "DD").t() + a(3, "DD").t()) + t(0.25, 0.3, a(1, "00").t()) +
                                            p(4) + outlineString);
                        ass_out.AppendEvent(50 - i, "pt", t4 + i * 0.01, t5 + i * 0.01,
                                            moveString + move(x, y, x - 100, y) + fad(0, 0.2) + a(1, "FF") + a(3, "CC") + c(3, shadowColor) + bord(5) + blur(5) +
                                            p(4) + outlineString);
                    }
                }

                if (iEv == 0 || iEv == 3 || true)
                {
                    double xstart = 0;
                    double xend   = lastx0 + FontHeight;
                    if (!isJp)
                    {
                        xstart = bakx0 - FontHeight;
                        xend   = PlayResX;
                    }
                    ass_out.AppendEvent(200, "pt", ev.Start, ev.Start + (xend - xstart) / 600.0,
                                        clip(4, outlines) + move(xstart, y0 + FontHeight / 2, xend, y0 + FontHeight / 2) +
                                        a(1, "00") + frz(-45) + blur(8) + fscx(200) +
                                        p(1) + "m 10 -50 l 10 50 -10 50 -10 -50");
                }

                if (!isJp)
                {
                    continue;
                }

                string[] SS =
                {
                    "xxxxxxxxx.xx.x",
                    "xx.x...xxxxxx."
                };
                for (int i = 0; i < 2; i++)
                {
                    if (SS[1 - i][iEv] == '.')
                    {
                        continue;
                    }

                    Line line = new Line {
                        X0 = lastx0 + 5, Y0 = y0 + FontHeight + 7, X1 = MarginLeft
                    };
                    if (i == 1)
                    {
                        line.X0 = MarginLeft;
                        line.X1 = lastx0 + 5;
                        line.Y0 = y0 - 8;
                    }
                    line.Y1 = line.Y0;
                    CompositeCurve curve = new CompositeCurve {
                        MinT = ev.End - 0.5
                    };
                    if (i == 1)
                    {
                        curve.MinT = ev.Start - 0.5;
                    }
                    curve.MaxT = curve.MinT + Math.Abs(line.X0 - line.X1) / 1000.0;
                    curve.AddCurve(curve.MinT, curve.MaxT, line);
                    List <ASSPointF> pts = curve.GetPath_DT(1.0 / 1000.0);
                    foreach (ASSPointF pt in pts)
                    {
                        ass_out.AppendEvent(8, "pt", pt.T, pt.T + 0.8,
                                            pos(pt.X, pt.Y) + a(1, "77") + a(3, "F4") + bord(1) + blur(1) + c(3, "FF973F") + c(1, "FF973F") +
                                            t(0, 0.2, bord(6).t() + blur(6).t()) +
                                            t(0.6, 0.8, bord(1).t() + blur(1).t()) +
                                            p(1) + "m 0 0 l 1 0 1 1 0 1");
                        ass_out.AppendEvent(9, "pt", pt.T, pt.T + 0.8,
                                            pos(pt.X, pt.Y) + a(1, "77") + a(3, "AA") + bord(1) + blur(1) + c(3, "FF973F") + c(1, "FF973F") +
                                            t(0, 0.1, bord(1.8).t() + blur(1.8).t()) +
                                            t(0.1, 0.2, bord(2.3).t() + blur(2.3).t()) +
                                            t(0.2, 0.6, bord(1.8).t() + blur(1.8).t()) +
                                            t(0.6, 0.8, bord(1).t() + blur(1).t()) +
                                            p(1) + "m 0 0 l 1 0 1 1 0 1");
                        ass_out.AppendEvent(10, "pt", pt.T, pt.T + 0.8,
                                            pos(pt.X, pt.Y) + a(1, "77") + a(3, "AA") + bord(0.7) + blur(0.7) +
                                            t(0, 0.1, bord(1.6).t() + blur(1.6).t()) +
                                            t(0.1, 0.2, bord(2.1).t() + blur(2.1).t()) +
                                            t(0.2, 0.6, bord(1.6).t() + blur(1.6).t()) +
                                            t(0.6, 0.8, bord(0.8).t() + blur(0.8).t() + a(3, "FF").t()) +
                                            p(1) + "m 0 0 l 1 0 1 1 0 1");
                    }
                }
            }

            Console.WriteLine(ass_out.Events.Count);
            ass_out.SaveFile(this.OutFileName);
        }
コード例 #11
0
        public override void Run()
        {
            ASS ass_in  = ASS.FromFile(this.InFileName);
            ASS ass_out = new ASS()
            {
                Header = ass_in.Header, Events = new List <ASSEvent>()
            };

            for (int iEv = 0; iEv < ass_in.Events.Count; iEv++)
            {
                bool isJp = true;
                this.MaskStyle = isJp ?
                                 "Style: Default,EPSON 行書体M,26,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,0,0,0,0,100,100,0,0,1,0,0,5,0,0,0,128" :
                                 "Style: Default,仿宋,36,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,0,0,0,0,100,100,0,0,1,0,0,5,0,0,0,1";
                this.FontHeight = isJp ? 26 : 30;
                int jEv = isJp ? iEv : iEv;
                //if (jEv != 0) continue;
                ASSEvent        ev         = ass_in.Events[iEv];
                List <KElement> kelems     = ev.SplitK(true);
                int             totalWidth = GetTotalWidth(ev);
                int             x0         = (PlayResX - MarginLeft - MarginRight - totalWidth) / 2 + MarginLeft;
                int             y0         = (isJp) ? (PlayResY - MarginBottom - FontHeight) : MarginTop;
                int             kSum       = 0;
                int             x0_start   = x0;
                string          outlines   = "";
                List <KeyValuePair <double, ASSPoint> > textpath = new List <KeyValuePair <double, ASSPoint> >();
                string MainColor = "112836";
                if (iEv >= 8)
                {
                    MainColor = "C5A8A0";
                }
                for (int iK = 0; iK < kelems.Count; iK++)
                {
                    Console.WriteLine("{0} / {1} : {2} / {3}", iEv + 1, ass_in.Events.Count, iK + 1, kelems.Count);
                    KElement ke     = kelems[iK];
                    Size     sz     = GetSize(ke.KText);
                    double   kStart = ev.Start + kSum * 0.01;
                    double   kEnd   = kStart + ke.KValue * 0.01;
                    kSum += ke.KValue;
                    int x     = x0 + this.FontSpace + sz.Width / 2;
                    int y     = y0 + FontHeight / 2;
                    int x_an7 = x0;
                    int y_an7 = y0;
                    x0 += this.FontSpace + sz.Width;
                    if (ke.KText.Trim().Length == 0)
                    {
                        continue;
                    }
                    StringMask mask    = GetMask(ke.KText, x, y);
                    string     evStyle = isJp ? "op_jp" : "op_cn";

                    /*
                     * string outlineFontname = isJp ? "EPSON 行書体M" : "方正准圆_GBK";
                     * int outlineEncoding = isJp ? 128 : 1;
                     * int xoffset = isJp ? 0 : -1;
                     * if (isJp && ke.KText[0] == '中') xoffset = -2;
                     * string outlineString = GetOutline(x - sz.Width / 2 + xoffset, y - FontHeight / 2, ke.KText[0], outlineFontname, outlineEncoding, FontHeight, 0, 179);
                     * outlines += outlineString;
                     * */

                    double t0 = ev.Start - 0.5 + iK * 0.1;
                    double t1 = t0 + 0.5;
                    double t2 = kStart;
                    double t3 = ev.End - 0.5 + iK * 0.1;
                    double t4 = t3 + 0.5;

                    ass_out.AppendEvent(50, evStyle, t0, t4,
                                        fad(t1 - t0, t4 - t3) + pos(x, y) +
                                        a(1, "00") + c(1, MainColor) +
                                        ke.KText);
                    ass_out.AppendEvent(49, evStyle, t0, t4,
                                        fad(t1 - t0, t4 - t3) + pos(x + 1.5, y + 1.5) +
                                        a(1, "00") + c(1, "000000") + blur(1) +
                                        ke.KText);
                    ass_out.AppendEvent(60, evStyle, t2, t2 + 0.5,
                                        fad(0, 0.42) + pos(x, y) +
                                        a(1, "00") + c(1, "FFFFFF") +
                                        ke.KText);
                    ass_out.AppendEvent(60, evStyle, t2, t2 + 1,
                                        pos(x + 1.5, y + 1.5) +
                                        a(1, "00") + c(1, "FFFFFF") + blur(1) +
                                        t(0, 1, 0.8, a(1, "FF").t()) +
                                        ke.KText);
                    ass_out.AppendEvent(60, evStyle, t2, t2 + 1,
                                        fad(0, 0.42) +
                                        pos(x, y) +
                                        a(1, "FF") + a(3, "BB") + c(3, "FFFFFF") +
                                        blur(3) + bord(2.5) +
                                        t(0, 1, 0.8, a(3, "FF").t()) +
                                        ke.KText);

                    textpath.Add(new KeyValuePair <double, ASSPoint>(kStart, new ASSPoint {
                        X = x, Y = y, Start = kStart, End = kEnd
                    }));

                    if (iEv == 1)
                    {
                        for (int i = 0; i < 100; i++)
                        {
                            double ptt0 = Common.RandomDouble(rnd, t3, t4);
                            double ptt1 = ptt0 + Common.RandomDouble(rnd, 0.5, 1);
                            double ptx0 = Common.RandomDouble(rnd, x - 17, x + 17) - 25;
                            double pty0 = Common.RandomDouble(rnd, y - 17, y + 17);
                            double ptx1 = ptx0 + Common.RandomDouble(rnd, 30, 50) * 1.4;
                            double pty1 = pty0 + Common.RandomDouble(rnd, 5, 30) * Common.RandomSig(rnd);
                            int    tmp1 = Common.RandomInt(rnd, 0, 359);
                            ass_out.AppendEvent(70, "pt", ptt0, ptt1,
                                                move(ptx0, pty0, ptx1, pty1) + a(1, "00") + blur(0.5) + a(4, "DD") + c(4, "000000") + shad(2) +
                                                fad(0, 0.5) +
                                                //c(1, Common.RandomBool(rnd, 0.9) ? MainColor : Common.scaleColor(MainColor, "FFFFFF", 0.2)) +
                                                c(1, Common.scaleColor(MainColor, "FFFFFF", Common.RandomDouble(rnd, 0, 0.15))) +
                                                frz(tmp1) +
                                                CreatePolygon(rnd, 15, 23, 6));
                        }
                    }
                    if (iEv >= 2 && iEv <= 4)
                    {
                        for (int i = 0; i < (kEnd - kStart) * 30; i++)
                        {
                            double ptt0 = Common.RandomDouble(rnd, kStart, kEnd);
                            double ptt1 = ptt0 + Common.RandomDouble(rnd, 0.5, 1) * 2;
                            double ptx0 = Common.RandomDouble(rnd, x - 13, x + 13);
                            double pty0 = Common.RandomDouble(rnd, y - 13, y + 13);
                            double ptx1 = ptx0 - Common.RandomDouble(rnd, 30, 100) * 1.4;
                            double pty1 = pty0 + Common.RandomDouble(rnd, 20, 45);
                            int    tmp1 = Common.RandomInt(rnd, 0, 359);
                            ass_out.AppendEvent(70, "pt", ptt0, ptt1,
                                                move(ptx0, pty0, ptx1, pty1) + a(1, "00") + blur(0.5) + a(4, "DD") + c(4, "000000") + shad(2) +
                                                fad(0, 0.5) +
                                                //c(1, Common.RandomBool(rnd, 0.9) ? MainColor : Common.scaleColor(MainColor, "FFFFFF", 0.2)) +
                                                c(1, Common.scaleColor(MainColor, "FFFFFF", Common.RandomDouble(rnd, 0, 0.15))) +
                                                frz(tmp1) +
                                                CreatePolygon(rnd, 15, 23, 6));
                        }
                    }
                }

                if (iEv >= 5)// && iEv <= 7)
                {
                    for (int i = 0; i < textpath.Count - 1; i++)
                    {
                        if (textpath[i].Value.End < textpath[i + 1].Value.Start)
                        {
                            textpath[i].Value.End = textpath[i + 1].Value.Start;
                        }
                    }
                    textpath[textpath.Count - 1].Value.End = ev.End;

                    emitterList = new List <ASSPointF>();
                    foreach (KeyValuePair <double, ASSPoint> pair in textpath)
                    {
                        emitterList.Add(new ASSPointF
                        {
                            Start = pair.Value.Start,
                            End   = pair.Value.End,
                            X     = pair.Value.X + Common.RandomDouble(rnd, -20, 20),
                            Y     = pair.Value.Y + Common.RandomDouble(rnd, -20, 20)
                        });
                    }

                    forceCurve = new CompositeCurve {
                        MinT = ev.Start, MaxT = ev.End + 10
                    };
                    double lastag = 0;
                    for (double time = forceCurve.MinT; time <= forceCurve.MaxT; time += 0.7)
                    {
                        double ag = Common.RandomDouble(rnd, 0, Math.PI * 2);
                        while (Math.Abs(ag - lastag) < Math.PI * 0.5 || Math.Abs(ag - lastag) > Math.PI * 1.5)
                        {
                            ag = Common.RandomDouble(rnd, 0, Math.PI * 2);
                        }
                        lastag = ag;
                        double x = 1500.0 * Math.Cos(ag);
                        double y = 800.0 * Math.Sin(ag);
                        forceCurve.AddCurve(time, time + 0.7, new Line {
                            X0 = x, Y0 = y, X1 = 0, Y1 = 0, Acc = 0.7
                        });
                    }

                    NumberPerSecond = 110;
                    XXParticleSystem xxps = new XXParticleSystem();
                    xxps.Emitter                = this;
                    xxps.ForceField             = this;
                    xxps.StartTime              = ev.Start;
                    xxps.EndTime                = ev.End;
                    xxps.InterpolationPrecision = 0.03;
                    xxps.Resistance             = 0.04;
                    xxps.Repulsion              = -3600;
                    xxps.Gravity                = 0;
                    xxps.GravityPosition        = this;

                    xxps.InterpolationPrecision = 0.01;
                    List <KeyValuePair <XXParticleElement, List <string> > > result = xxps.RenderT();
                    foreach (KeyValuePair <XXParticleElement, List <string> > pair in result)
                    {
                        string s     = CreatePolygon(rnd, 12, 12, 4);
                        string ptstr = @"{\p1}m 0 0 l 1 0 1 1 0 1";
                        string ptcol = "532BFF";
                        ass_out.AppendEvent(70, "pt", pair.Key.Born, pair.Key.Born + pair.Key.Life,
                                            pos(-100, -100) +
                                            pair.Value[1] +
                                            ptstr + "\\N" + r() +
                                            pair.Value[0] +
                                            ptstr + r() +
                                            a(1, "00") + blur((iEv <= 7) ? 0.6 : 0.8) + a(4, "DD") + c(4, "000000") + shad(2) +
                                            fad(0, 0.5) +
                                            c(1, Common.scaleColor(MainColor, "FFFFFF", Common.RandomDouble(rnd, 0, 0.15))) +
                                            CreatePolygon(rnd, 15, 23, 6));
                    }
                }
            }

            Console.WriteLine(ass_out.Events.Count);
            ass_out.SaveFile(this.OutFileName);
        }
コード例 #12
0
        public override void Run()
        {
            ASS ass_in  = ASS.FromFile(this.InFileName);
            ASS ass_out = new ASS()
            {
                Header = ass_in.Header, Events = new List <ASSEvent>()
            };

            ParticleIllusionExporter pie = new ParticleIllusionExporter();

            for (int iEv = 0; iEv < ass_in.Events.Count; iEv++)
            {
                bool isJp = iEv <= 13;
                int  iiEv = isJp ? iEv : iEv - 14;
                //if (iiEv !=4 && iiEv != 5) continue;
                this.MaskStyle = isJp ?
                                 "Style: Default,HGSGyoshotai,26,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,0,0,0,0,100,100,0,0,0,0,0,5,0,0,0,128" :
                                 "Style: Default,方正行楷简体,30,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,0,0,0,0,100,100,0,0,0,0,0,5,0,0,0,134";
                ASSEvent        ev       = ass_in.Events[iEv];
                List <KElement> kelems   = ev.SplitK(true);
                int             sw       = GetTotalWidth(ev);
                int             x0       = (isJp) ? MarginLeft : PlayResX - MarginRight - sw;
                int             y0       = (!isJp) ? (PlayResY - MarginBottom - FontHeight) : MarginTop;
                int             startx0  = x0;
                int             kSum     = 0;
                string          outlines = "";
                for (int iK = 0; iK < kelems.Count; iK++)
                {
                    Console.WriteLine("{0} / {1} : {2} / {3}", iEv + 1, ass_in.Events.Count, iK + 1, kelems.Count);
                    string   evStyle = isJp ? "jp" : "cn";
                    string   ptStyle = "pt";
                    KElement ke      = kelems[iK];
                    Size     sz      = GetSize(ke.KText);
                    double   kStart  = ev.Start + kSum * 0.01;
                    double   kEnd    = kStart + ke.KValue * 0.01;
                    kSum += ke.KValue;
                    int        x    = x0 + this.FontSpace + sz.Width / 2;
                    int        y    = y0 + FontHeight / 2;
                    StringMask mask = GetMask(ke.KText, x, y);
                    x0 += this.FontSpace + sz.Width;
                    if (ke.KText.Trim().Length == 0)
                    {
                        continue;
                    }

                    double t0 = ev.Start - 1 + (double)(x0 - startx0 - sz.Width) / 300.0;
                    double t1 = t0 + 1;
                    double t2 = kStart;
                    //if (iEv <= 3) t2 = ke.KStart_NoSplit;
                    double t3 = kEnd;
                    double t4 = ev.End - 1 + (double)(x0 - startx0 - sz.Width) / 300.0;
                    if (t4 < t3)
                    {
                        t4 = t3;
                    }
                    double t5 = t4 + 1;

                    if (iEv == 4 && iK == 0)
                    {
                        pie.Add(t2 - 0.35, new ASSPointF(0, y));
                    }
                    if (iEv >= 4 && isJp)
                    {
                        double last = ke.KValue * 0.01;
                        pie.Add(t2, new ASSPointF(x, y));
                        if (last > 0.23 && !Common.IsLetter(ke.KText[0]))
                        {
                            pie.Add(t2 + last - 0.23, new ASSPointF(x, y));
                        }
                    }

                    if (!isJp)
                    {
                        ass_out.AppendEvent(40, evStyle, t0, t5,
                                            pos(x + 1, y + 1) + fad(0.5, 0.5) + a(1, "00") + c(1, "000000") + blur(1) +
                                            ke.KText);
                        ass_out.AppendEvent(50, evStyle, t0, t5,
                                            pos(x, y) + fad(0.5, 0.5) + a(1, "00") +
                                            ke.KText);
                        continue;
                    }

                    {
                        CompositeCurve curve = new CompositeCurve {
                            MinT = t0, MaxT = t1
                        };
                        curve.AddCurve(t0, t1, new Curve1 {
                            X0 = x, Y0 = y, R = 30
                        });
                        foreach (ASSPointF pt in curve.GetPath_DT(0.007))
                        {
                            double tmp = pt.Theta * 100;
                            ass_out.AppendEvent(70, evStyle, pt.T, pt.T + 0.4,
                                                pos(pt.X, pt.Y) + fad(0, 0.3) + a(1, "00") + be(1) +
                                                fsc((int)tmp, (int)tmp) +
                                                ke.KText);
                            ass_out.AppendEvent(60, evStyle, pt.T, pt.T + 0.4,
                                                pos(pt.X + 1, pt.Y + 1) + fad(0, 0.3) + a(1, "DD") + c(1, "000000") + be(1) +
                                                fsc((int)tmp, (int)tmp) +
                                                ke.KText);
                        }

                        {
                            ass_out.AppendEvent(40, evStyle, t1, t5,
                                                pos(x + 1, y + 1) + fad(0.3, 0.5) + a(1, "00") + c(1, "000000") + blur(1) +
                                                ke.KText);
                            ass_out.AppendEvent(50, evStyle, t1, t5,
                                                pos(x, y) + fad(0.3, 0.5) + a(1, "00") +
                                                ke.KText);
                        }

                        if (iEv <= 3 || Common.IsLetter(ke.KText[0]))
                        {
                            for (double ti = ke.KStart_NoSplit; ti <= ke.KEnd_NoSplit; ti += 0.01)
                            {
                                ass_out.AppendEvent(70, evStyle, ti, ti + 0.35,
                                                    move(x, y, Common.RandomDouble(rnd, x - 5, x + 5), Common.RandomDouble(rnd, y - 5, y + 5)) +
                                                    fad(0, 0.2) + blur(1) + a(1, "AA") +
                                                    ke.KText);
                            }
                        }
                        else
                        {
                            for (double ti = t2; ti <= t3; ti += 0.01)
                            {
                                ass_out.AppendEvent(70, evStyle, ti, ti + 0.35,
                                                    move(x, y, Common.RandomDouble(rnd, x - 5, x + 5), Common.RandomDouble(rnd, y - 5, y + 5)) +
                                                    fad(0, 0.2) + blur(1) + a(1, "AA") +
                                                    ke.KText);
                            }
                        }
                    }
                }
            }

            pie.SaveToFile(@"G:\Workshop\hanasakeru\op\pi_export.txt");

            Console.WriteLine(ass_out.Events.Count);
            ass_out.SaveFile(this.OutFileName);
        }
コード例 #13
0
        public override void Run()
        {
            ASS ass_in  = ASS.FromFile(this.InFileName);
            ASS ass_out = new ASS();

            ass_out.Header = ass_in.Header;
            ass_out.Events = new List <ASSEvent>();

            Random rnd = new Random();

            for (int iEv = 0; iEv < ass_in.Events.Count; iEv++)
            {
                //if (iEv != 15) continue;
                ASSEvent        ev     = ass_in.Events[iEv];
                List <KElement> kelems = ev.SplitK(false);

                this.MaskStyle   = "Style: Default,TT-曲水B,44,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,0,0,0,0,100,100,0,0,0,0,0,5,0,0,0,128";
                this.FontName    = "TT-曲水B";
                this.FontCharset = 128;
                this.FontHeight  = 44;
                int totalWidth = GetTotalWidth(ev);
                int x0         = (PlayResX - MarginLeft - MarginRight - totalWidth) / 2 + MarginLeft;
                int x0_start   = x0;
                int y0         = PlayResY - MarginBottom - FontHeight;
                int kSum       = 0;

                CompositeCurve curve = new CompositeCurve {
                    MinT = ev.Start - 0.5, MaxT = ev.End
                };
                double curve_x0 = x0_start - FontHeight;
                double curve_y0 = y0 + 0.5 * FontHeight;
                double curve_t0 = curve.MinT;

                string[] mainColors =
                {
                    "21184E", // red
                    "4E1842", // purple
                    "4E181A", // blue
                    "184E1E", // green
                    "184E4D", // yellow
                    "393F15"  // another blue...
                };
                string mainColor = mainColors[2];
                if (iEv >= 4 && iEv <= 7)
                {
                    mainColor = mainColors[0];
                }
                if (iEv >= 8 && iEv <= 10)
                {
                    mainColor = mainColors[1];
                }
                if (iEv >= 11)
                {
                    mainColor = mainColors[5];
                }

                mainColor = "000000";

                string[] ptColors =
                {
                    "3600FF", // red
                    "FF00B0", // purple
                    "FF1C00", // blue
                    "00FFFF", // yellow
                    "00FF08", // green
                    "DCFF00"  // another blue...
                };
                string ptColor = ptColors[2];
                if (iEv > 10)
                {
                    ptColor = ptColors[5];
                }
                string ringColor = ptColors[1];
                if (iEv >= 11)
                {
                    ringColor = ptColors[5];
                }
                if (iEv >= 13)
                {
                    ringColor = "FFB100";
                }
                string torchColor = ptColors[1];
                if (iEv >= 11)
                {
                    torchColor = "FF7C00";
                }

                if (iEv == 3)
                {
                    ptColor = Common.scaleColor(ptColor, "FFFFFF", 0.7);
                }
                else
                {
                    ptColor = Common.scaleColor(ptColor, "FFFFFF", 0.5);
                }
                ringColor  = Common.scaleColor(ringColor, "FFFFFF", 0.5);
                torchColor = Common.scaleColor(torchColor, "FFFFFF", 0.5);

                for (int iK = 0; iK < kelems.Count; iK++)
                {
                    Console.WriteLine("{0} / {1} : {2} / {3}", iEv + 1, ass_in.Events.Count, iK + 1, kelems.Count);
                    KElement ke     = kelems[iK];
                    Size     sz     = GetSize(ke.KText);
                    double   kStart = ev.Start + kSum * 0.01;
                    double   kEnd   = kStart + ke.KValue * 0.01;
                    kSum += ke.KValue;
                    double     x     = x0 + this.FontSpace + sz.Width / 2;
                    double     y     = y0 + FontHeight / 2;
                    int        x_an7 = x0;
                    int        y_an7 = y0;
                    StringMask mask  = GetMask(ke.KText, (int)x, (int)y);
                    x0 += this.FontSpace + sz.Width;
                    if (ke.KText.Trim().Length == 0)
                    {
                        continue;
                    }

                    curve.AddCurve(curve_t0, kStart, new Line {
                        X0 = curve_x0, Y0 = curve_y0, X1 = x, Y1 = y
                    });
                    curve_x0 = x;
                    curve_y0 = y;
                    curve_t0 = kStart;

                    string evStyle = "op_jp";

                    ass_out.AppendEvent(49, evStyle, ev.Start - 0.3, ev.End + 0.3,
                                        pos(x + 1, y + 1) + fad(0.3, 0.3) +
                                        a(1, "77") + c(1, "000000") + blur(1) +
                                        ke.KText);
                    ass_out.AppendEvent(50, evStyle, ev.Start - 0.3, ev.End + 0.3,
                                        pos(x, y) + fad(0.3, 0.3) +
                                        a(1, "00") +
                                        ke.KText);
                    ass_out.AppendEvent(51, evStyle, ev.Start - 0.3, ev.End + 0.3,
                                        pos(x + 2, y + 2) + fad(0.3, 0.3) +
                                        a(1, "22") + c(1, mainColor) + blur(1) +
                                        ke.KText);

                    double remainStr = 0;
                    if (iEv == 3)
                    {
                        remainStr = 0.5;
                    }
                    if (iEv == 18)
                    {
                        remainStr = 0.5;
                    }

                    // light
                    double lastStr = 0.1;

                    // ring particle
                    if (iEv >= 8)
                    {
                        ass_out.AppendEvent(70, "pt", kStart, kStart + 0.4,
                                            pos(x, y) + fad(0.04, 0.25) +
                                            a(1, "77") + blur(1) +
                                            CreateCircle(50.5, 52.5));
                        ass_out.AppendEvent(70, "pt", kStart, kStart + 0.4,
                                            pos(x, y) + fad(0.04, 0.25) +
                                            a(1, "77") + blur(2) +
                                            CreateCircle(49, 54));

                        int ptCount = 150;
                        if (iEv >= 10)
                        {
                            ptCount = 250;
                        }
                        int ptRange = 12;
                        if (iEv >= 10)
                        {
                            ptRange = 20;
                        }
                        for (int iPt = 0; iPt < ptCount; iPt++)
                        {
                            double ptag = Common.RandomDouble(rnd, 0, Math.PI * 2);
                            double ptx0 = x + 51.5 * Math.Cos(ptag);
                            double pty0 = y + 51.5 * Math.Sin(ptag);
                            double ptx1 = Common.RandomDouble(rnd, ptx0 - ptRange, ptx0 + ptRange);
                            double pty1 = Common.RandomDouble(rnd, pty0 - ptRange, pty0 + ptRange);
                            double ptt  = 0.7;

                            double ptSize = 1;

                            ass_out.AppendEvent(81, "pt", kStart, kStart + ptt,
                                                move(ptx0, pty0, ptx1, pty1) + fad(0.04, 0.35) +
                                                a(1, "00") + blur(1) + fsc((int)(ptSize * 200)) +
                                                p(1) + "m 0 0 l 1 0 1 1 0 1");
                            ass_out.AppendEvent(80, "pt", kStart, kStart + ptt,
                                                move(ptx0, pty0, ptx1, pty1) + fad(0.04, 0.35) +
                                                a(1, "33") + blur(2) + fsc((int)(ptSize * 300)) + c(1, ringColor) +
                                                p(1) + "m 0 0 l 1 0 1 1 0 1");
                        }
                    }

                    // torch light
                    if (iEv >= 10)
                    {
                        ass_out.AppendEvent(70, "pt", kStart, kStart + 0.4,
                                            pos(x, y) + fad(0.04, 0.45) +
                                            a(1, "CC") + blur(1) + fsc(80) + t(fsc(160).t()) +
                                            CreateCircle(50.5, 52.5));
                        ass_out.AppendEvent(70, "pt", kStart, kStart + 0.4,
                                            pos(x, y) + fad(0.04, 0.45) +
                                            a(1, "CC") + blur(2) + fsc(80) + t(fsc(160).t()) +
                                            CreateCircle(49, 54));
                        ass_out.AppendEvent(70, "pt", kStart, kStart + 0.4,
                                            pos(x, y) + fad(0.04, 0.45) +
                                            a(1, "AA") + blur(1) + fsc(80) + t(fsc(20).t()) +
                                            CreateCircle(50.5, 52.5));
                        ass_out.AppendEvent(70, "pt", kStart, kStart + 0.4,
                                            pos(x, y) + fad(0.04, 0.45) +
                                            a(1, "AA") + blur(2) + fsc(80) + t(fsc(20).t()) +
                                            CreateCircle(49, 54));

                        if ((iEv == 10 && iK + 1 == kelems.Count) || iEv >= 15)
                        {
                            double tStep = 0.02;
                            for (double ptt0 = kStart - 0.1; ptt0 < kEnd; ptt0 += tStep)
                            {
                                int startag = Common.RandomInt(rnd, 0, 359);
                                int endag   = startag + Common.RandomSig(rnd) * Common.RandomInt(rnd, 50, 100);
                                ass_out.AppendEvent(20, "pt", ptt0, ptt0 + 1,
                                                    pos(x, y) + fad(0.3, 0.3) +
                                                    a(1, "00") + be(1) + c(1, torchColor) +
                                                    frz(startag) + t(frz(endag).t()) +
                                                    CreateLight1(rnd));
                                ass_out.AppendEvent(21, "pt", ptt0, ptt0 + 1,
                                                    pos(x, y) + fad(0.3, 0.3) +
                                                    a(1, "11") + be(1) +
                                                    frz(startag) + t(frz(endag).t()) +
                                                    CreateLight1(rnd, 60));
                            }
                        }
                    }

                    // starglow
                    foreach (ASSPoint point in mask.Points)
                    {
                        if (!Common.RandomBool(rnd, 0.4))
                        {
                            continue;
                        }
                        double xr = (double)(point.X - mask.X0) / mask.Width;
                        double yr = (double)(point.Y - mask.Y0) / mask.Height;
                        Func <double, double> f1 = _x => Math.Pow(Math.Abs(_x) * 2.0, 1.5);

                        ass_out.AppendEvent(70, "pt", kStart, kEnd + lastStr,
                                            an(7) + pos(point.X, point.Y) + fad(0.05, kEnd + 0.2 - kStart - 0.05 - 0.08) +
                                            a(1, Common.scaleAlpha("FF", "AA", f1(xr))) + be(1) +
                                            fscx(100 + f1(xr) * 60) +
                                            p(1) + "m 0 0 l 40 0 0 1 -40 0 0 0");
                        ass_out.AppendEvent(70, "pt", kStart, kEnd + lastStr,
                                            an(7) + pos(point.X, point.Y) + fad(0.05, kEnd + 0.2 - kStart - 0.05 - 0.08) +
                                            a(1, Common.scaleAlpha("FF", "AA", f1(yr))) + be(1) +
                                            fscx(100 + f1(yr) * 60) + frz(90) +
                                            p(1) + "m 0 0 l 40 0 0 1 -40 0 0 0");

                        if (remainStr > 0)
                        {
                            // remain "starglow"
                            ass_out.AppendEvent(70, "pt", (kEnd + lastStr - kStart) * 0.5 + kStart, ev.End + 0.3,
                                                an(7) + pos(point.X, point.Y) + fad((kEnd + lastStr - kStart) * 0.5, 0.3) +
                                                a(1, Common.scaleAlpha("FF", "AA", remainStr * f1(xr))) + be(1) +
                                                fscx(100 + f1(xr) * 60) +
                                                p(1) + "m 0 0 l 40 0 0 1 -40 0 0 0");
                            ass_out.AppendEvent(70, "pt", (kEnd + lastStr - kStart) * 0.5 + kStart, ev.End + 0.3,
                                                an(7) + pos(point.X, point.Y) + fad((kEnd + lastStr - kStart) * 0.5, 0.3) +
                                                a(1, Common.scaleAlpha("FF", "AA", remainStr * f1(yr))) + be(1) +
                                                fscx(100 + f1(yr) * 60) + frz(90) +
                                                p(1) + "m 0 0 l 40 0 0 1 -40 0 0 0");

                            // disappear with particles
                            if (Common.RandomBool(rnd, 1))
                            {
                                double ptt0 = ev.End + iK * 0.02;
                                double ptt1 = ptt0 + Common.RandomDouble_Gauss(rnd, 1.2, 2.4, 2);

                                string sFrz   = frz(Common.RandomInt(rnd, 0, 359));
                                string sMove  = move(point.X, point.Y, point.X + Common.RandomInt(rnd, 100, 200), point.Y);
                                string sMoveT = t(0, ptt1 - ptt0, 0.5, fscx((Math.Abs(Common.RandomDouble_Gauss(rnd, -1, 1, 3)) * 180 + 20) * 100).t());
                                string tS1    = t(0, Common.RandomDouble(rnd, 1, 2) * (ptt1 - ptt0), a(1, "FFFF").t());
                                point.Y += Common.RandomInt(rnd, -5, 5);
                                ass_out.AppendEvent(80, "pt", ptt0, ptt1,
                                                    org(point.X, point.Y) + pos(point.X, point.Y) + sMoveT + sFrz +
                                                    p(1) + "m 0 0 l 1 0 1 1 0 1" + r() + sFrz + fad(0, 0.4) +
                                                    t(0, 0.3, fscx(700).t()) + t(0.3, 1, 2, fscx(150).t()) +
                                                    blur(1) + a(1, "00") + tS1 +
                                                    p(1) + "m 0 0 l 1 0 1 1 0 1");
                                ass_out.AppendEvent(20, "pt", ptt0, ptt1,
                                                    org(point.X, point.Y) + pos(point.X, point.Y) + sMoveT + sFrz +
                                                    p(1) + "m 0 0 l 1 0 1 1 0 1" + r() + sFrz + fad(0, 0.4) +
                                                    t(0, 0.3, fscx(1000).t()) + t(0.3, 1, 2, fscx(250).t()) +
                                                    fscy(150) + c(1, ptColor) +
                                                    blur(2) + a(1, "00") + tS1 +
                                                    p(1) + "m 0 0 l 1 0 1 1 0 1");
                            }
                        }
                    }

                    ass_out.AppendEvent(60, evStyle, kStart, kEnd + lastStr,
                                        pos(x + 1, y + 1) + fad(0.05, kEnd + lastStr - kStart - 0.05 - 0.08) +
                                        a(1, "00") +
                                        a(3, "22") + bord(2.5) + blur(2.5) +
                                        ke.KText);
                    ass_out.AppendEvent(60, evStyle, kStart, kEnd + lastStr,
                                        pos(x + 1, y + 1) + fad(0.05, kEnd + lastStr - kStart - 0.05 - 0.08) +
                                        a(1, "00") +
                                        a(3, "22") + bord(5) + blur(5) +
                                        ke.KText);

                    if (remainStr > 0)
                    {
                        ass_out.AppendEvent(60, evStyle, (kEnd + lastStr - kStart) * 0.5 + kStart + iK * 0.02, ev.End + 0.3 + iK * 0.02,
                                            pos(x + 1, y + 1) + fad((kEnd + lastStr - kStart) * 0.5, 0.3) +
                                            a(1, Common.scaleAlpha("FF", "00", remainStr)) +
                                            a(3, Common.scaleAlpha("FF", "22", remainStr)) + bord(2.5) + blur(2.5) +
                                            ke.KText);
                        ass_out.AppendEvent(60, evStyle, kStart + iK * 0.02, kEnd + lastStr + iK * 0.02,
                                            pos(x + 1, y + 1) + fad(0.05, kEnd + lastStr - kStart - 0.05 - 0.08) +
                                            a(1, Common.scaleAlpha("FF", "00", remainStr)) +
                                            a(3, Common.scaleAlpha("FF", "22", remainStr)) + bord(5) + blur(5) +
                                            ke.KText);

                        ass_out.AppendEvent(60, evStyle, ev.End - 0.1 + iK * 0.02, ev.End + 0.3 + iK * 0.02,
                                            pos(x + 1, y + 1) + fad(0.05, 0.2) +
                                            a(1, "00") +
                                            a(3, "22") + bord(2.5) + blur(2.5) +
                                            ke.KText);
                        ass_out.AppendEvent(60, evStyle, ev.End - 0.1 + iK * 0.02, ev.End + 0.3 + iK * 0.02,
                                            pos(x + 1, y + 1) + fad(0.05, 0.2) +
                                            a(1, "00") +
                                            a(3, "22") + bord(5) + blur(5) +
                                            ke.KText);
                    }
                }

                if (iEv > 10)
                {
                    curve.AddCurve(curve_t0, curve.MaxT, new Line {
                        X0 = curve_x0, Y0 = curve_y0, X1 = curve_x0, Y1 = curve_y0
                    });
                    foreach (ASSPointF point in curve.GetPath_DT(0.002))
                    {
                        double ptt0 = point.T;
                        double ptt1 = ptt0 + Common.RandomDouble_Gauss(rnd, 1.2, 1.8, 2);

                        string sFrz   = frz(Common.RandomInt(rnd, 0, 359));
                        string sMove  = move(point.X, point.Y, point.X + Common.RandomInt(rnd, 100, 200), point.Y);
                        string sMoveT = t(0, ptt1 - ptt0, 0.5, fscx((Math.Abs(Common.RandomDouble_Gauss(rnd, -1, 1, 3)) * 180 + 20) * 100).t());
                        string tS1    = t(0, Common.RandomDouble(rnd, 1, 2) * (ptt1 - ptt0), a(1, "FFFF").t());

                        ass_out.AppendEvent(80, "pt", ptt0, ptt1,
                                            org(point.X, point.Y) + pos(point.X, point.Y) + sMoveT + sFrz +
                                            p(1) + "m 0 0 l 1 0 1 1 0 1" + r() + sFrz + fad(0, 0.4) +
                                            t(0, 0.3, fscx(700).t()) + t(0.3, 1, 2, fscx(150).t()) +
                                            blur(1) + a(1, "00") + tS1 +
                                            p(1) + "m 0 0 l 1 0 1 1 0 1");
                        ass_out.AppendEvent(20, "pt", ptt0, ptt1,
                                            org(point.X, point.Y) + pos(point.X, point.Y) + sMoveT + sFrz +
                                            p(1) + "m 0 0 l 1 0 1 1 0 1" + r() + sFrz + fad(0, 0.4) +
                                            t(0, 0.3, fscx(1000).t()) + t(0.3, 1, 2, fscx(250).t()) +
                                            fscy(150) + c(1, ptColor) +
                                            blur(2) + a(1, "00") + tS1 +
                                            p(1) + "m 0 0 l 1 0 1 1 0 1");
                    }
                }
            }

            ass_out.SaveFile(OutFileName);
            Console.WriteLine("Lines : {0}", ass_out.Events.Count);
        }
コード例 #14
0
        public override void Run()
        {
            ASS ass_in  = ASS.FromFile(this.InFileName);
            ASS ass_out = new ASS()
            {
                Header = ass_in.Header, Events = new List <ASSEvent>()
            };

            string cPink = "8283FE";

            for (int iEv = 0; iEv < ass_in.Events.Count; iEv++)
            {
                bool isJp = iEv <= 12;
                //if (isJp) continue;
                //if (iEv != 13) continue;
                //if (!(iEv >= 0 && 7 >= iEv)) continue;
                ASSEvent        ev     = ass_in.Events[iEv];
                List <KElement> kelems = ev.SplitK(!isJp);
                if (!isJp)
                {
                    foreach (KElement ke in kelems)
                    {
                        ke.KValue = 10;
                    }
                }
                int    x0       = MarginLeft;
                int    y0       = (isJp) ? (PlayResY - MarginBottom - FontHeight) : MarginTop;
                int    kSum     = 0;
                string outlines = "";
                double ev0_sp   = 500;
                for (int iK = 0; iK < kelems.Count; iK++)
                {
                    Console.WriteLine("{0} / {1} : {2} / {3}", iEv + 1, ass_in.Events.Count, iK + 1, kelems.Count);
                    this.MaskStyle = isJp ?
                                     "Style: Default,DFGMaruGothic-Md,28,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,0,0,0,0,100,100,0,0,0,0,0,5,0,0,0,128" :
                                     "Style: Default,方正准圆_GBK,28,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,0,0,0,0,100,100,0,0,0,0,0,5,0,0,0,134";
                    string   evStyle         = isJp ? "jp" : "cn";
                    string   outlineFontname = isJp ? "DFGMaruGothic-Md" : "方正准圆_GBK";
                    int      outlineEncoding = isJp ? 128 : 134;
                    KElement ke     = kelems[iK];
                    Size     sz     = GetSize(ke.KText);
                    double   kStart = ev.Start + kSum * 0.01;
                    double   kEnd   = kStart + ke.KValue * 0.01;
                    kSum += ke.KValue;
                    int        x     = x0 + this.FontSpace + sz.Width / 2;
                    int        y     = y0 + FontHeight / 2;
                    int        x_an7 = x0;
                    int        y_an7 = y0;
                    StringMask mask  = GetMask(ke.KText, x, y);
                    x0 += this.FontSpace + sz.Width;
                    if (ke.KText.Trim().Length == 0)
                    {
                        continue;
                    }
                    string outlineString = GetOutline(x - sz.Width / 2, y - FontHeight / 2, ke.KText[0], outlineFontname, outlineEncoding, FontHeight, 0, 191);
                    if (!isJp)
                    {
                        outlineString = GetOutline(x - sz.Width / 2, y - FontHeight / 2, ke.KText[0], outlineFontname, outlineEncoding, FontHeight, 0, 177);
                    }
                    outlines += outlineString;

                    if (iEv == 0)
                    {
                        double t0 = kStart - 1;
                        double t1 = kStart - 0.1;
                        double t2 = kStart + 0.4;
                        double t3 = ev.End - 0.5 + iK * 0.07;
                        double t4 = t3 + 0.5;

                        string cMain  = "000071";
                        string cMain2 = "1DA4DD";// "10B7FC";

                        ass_out.AppendEvent(30, evStyle, t0, t3,
                                            pos(x + 2, y + 2) + a(1, "00") + c(1, "000000") + blur(1.2) + fad(0.8, 0) +
                                            ke.KText);
                        ass_out.AppendEvent(30, evStyle, t3, t4,
                                            pos(x + 2, y + 2) + a(1, "00") + c(1, "000000") + blur(1.2) + fad(0, t4 - t3) +
                                            ke.KText);
                        ass_out.AppendEvent(40, "pt", t1, 7 + x / ev0_sp + 0.3,
                                            clip(4, outlineString) + pos(x, y) + a(1, "33") + c(1, "222222") + fad(t2 - t1, 0.3) +
                                            p(1) + "m -20 -20 l 20 -20 20 20 -20 20");
                        ass_out.AppendEvent(40, "pt", 7 + x / ev0_sp - 0.3, t3,
                                            clip(4, outlineString) + pos(x, y) + a(1, "33") + c(1, cMain) + fad(0.3, 0) +
                                            p(1) + "m -20 -20 l 20 -20 20 20 -20 20");
                        ass_out.AppendEvent(40, "pt", t3, t4,
                                            clip(4, outlineString) + pos(x, y) + a(1, "33") + c(1, cMain) + fad(0, t4 - t3) +
                                            p(1) + "m -20 -20 l 20 -20 20 20 -20 20");
                        for (int i = 0; i < 4; i++)
                        {
                            int lumsz = 5 - i;
                            ass_out.AppendEvent(40, "pt", 7 + x / ev0_sp - 0.3, t4,
                                                pos(0, 0) + a(1, "FF") + a(3, "DD") + blur(lumsz) + bord(lumsz) + c(3, "1D4FDD") + fad(0.3, 0.5) +
                                                p(4) + outlineString);
                        }
                        double lumX = Common.RandomInt(rnd, x - 12, x + 12);
                        double lumY = Common.RandomInt(rnd, y - 12, y + 12);
                        for (int i = 0; i < 3; i++)
                        {
                            int lumsz  = 8 + i * 2;
                            int lumsz2 = lumsz - 1;
                            ass_out.AppendEvent(50, "pt", t1, t2,
                                                clip(4, outlineString) + pos(lumX, lumY) +
                                                a(1, "44") + a(3, "00") + c(1, cMain) + c(3, cMain) + t(bord(lumsz).t() + blur(lumsz).t()) +
                                                p(1) + "m 0 0 l 1 0 1 1 0 1");
                            ass_out.AppendEvent(50, "pt", t2, 7 + x / ev0_sp + 0.3, // Speed : 200
                                                clip(4, outlineString) + pos(lumX, lumY) + fad(0, 0.3) +
                                                a(1, "44") + a(3, "00") + c(1, cMain) + c(3, cMain) + bord(lumsz) + blur(lumsz) +
                                                p(1) + "m 0 0 l 1 0 1 1 0 1");
                            ass_out.AppendEvent(50, "pt", 7 + x / ev0_sp - 0.3, t3,// Speed : 200
                                                clip(4, outlineString) + pos(lumX, lumY) + fad(0.3, 0) +
                                                a(1, "44") + a(3, "00") + c(1, cMain2) + c(3, cMain2) + bord(lumsz2) + blur(lumsz2) +
                                                p(1) + "m 0 0 l 1 0 1 1 0 1");
                            ass_out.AppendEvent(50, "pt", t3, t4,
                                                clip(4, outlineString) + pos(lumX, lumY) +
                                                a(1, "44") + a(3, "00") + c(1, cMain2) + c(3, cMain2) + bord(lumsz2) + blur(lumsz2) +
                                                t(bord(0).t() + blur(0).t()) +
                                                p(1) + "m 0 0 l 1 0 1 1 0 1");
                        }
                        for (int i = 0; i < 4; i++)
                        {
                            double ptt0 = Common.RandomDouble(rnd, 7, 9);
                            double ptt1 = ptt0 + 0.5;
                            double ptx0 = Common.RandomDouble(rnd, x - 15, x + 15);
                            double pty0 = Common.RandomDouble(rnd, y - 15, y + 15) + 40;
                            double ptx1 = Common.RandomDouble(rnd, ptx0 + 10, ptx0 + 15);
                            double pty1 = Common.RandomDouble(rnd, pty0 - 80, pty0 - 100);
                            for (int j = 0; j < 3; j++)
                            {
                                double lumsz = 4 - j * 1;
                                ass_out.AppendEvent(90, "pt", ptt0, ptt1,
                                                    move(ptx0, pty0, ptx1, pty1) + a(1, "44") + a(3, "00") +
                                                    bord(lumsz) + blur(lumsz) + fad(0, ptt1 - ptt0) +
                                                    p(1) + "m 0 0 l 1 0 1 1 0 1");
                            }
                            ass_out.AppendEvent(89, "pt", ptt0, ptt1,
                                                move(ptx0, pty0, ptx1, pty1) + a(1, "44") + a(3, "77") +
                                                bord(8) + blur(8) + fad(0, ptt1 - ptt0) +
                                                p(1) + "m 0 0 l 1 0 1 1 0 1");
                        }
                    }
                    else if (iEv == 1)
                    {
                        double t0 = ev.Start - 0.5 + iK * 0.07;
                        double t1 = kStart - 0.1;
                        double t2 = kStart + 0.4;
                        double t3 = ev.End - 0.5 + iK * 0.07;
                        double t4 = t3 + 0.5;

                        string cMain = "FFFFFF";
                        if (iEv != 1)
                        {
                            cMain = cPink;
                        }
                        string cShad = "222222";
                        if (iEv != 1)
                        {
                            cShad = "FFFFFF";
                        }

                        ass_out.AppendEvent(30, evStyle, t0, t3,
                                            pos(x + 2, y + 2) + a(1, "00") + c(1, "000000") + blur(1.2) + fad(0.8, 0) +
                                            ke.KText);
                        ass_out.AppendEvent(30, evStyle, t3, t4,
                                            pos(x + 2, y + 2) + a(1, "00") + c(1, "000000") + blur(1.2) + fad(0, t4 - t3) +
                                            ke.KText);
                        ass_out.AppendEvent(40, "pt", t1, t3,
                                            clip(4, outlineString) + pos(x, y) + a(1, "33") + c(1, cShad) + fad(t2 - t1, 0) +
                                            p(1) + "m -20 -20 l 20 -20 20 20 -20 20");
                        ass_out.AppendEvent(40, "pt", t3, t4,
                                            clip(4, outlineString) + pos(x, y) + a(1, "33") + c(1, cShad) + fad(0, t4 - t3) +
                                            p(1) + "m -20 -20 l 20 -20 20 20 -20 20");
                        for (int i = 0; i < 4; i++)
                        {
                            int lumsz = 5 - i;
                            ass_out.AppendEvent(30, "pt", t1, t4,
                                                pos(0, 0) + a(1, "FF") + a(3, "DD") + blur(lumsz) + bord(lumsz) + c(3, "FFFFFF") + fad(0.3, 0.5) +
                                                p(4) + outlineString);
                        }
                        double lumX = Common.RandomInt(rnd, x - 12, x + 12);
                        double lumY = Common.RandomInt(rnd, y - 12, y + 12);
                        for (int i = 0; i < 3; i++)
                        {
                            int lumsz = 8 + i * 2;
                            ass_out.AppendEvent(50, "pt", t1, t2,
                                                clip(4, outlineString) + pos(lumX, lumY) +
                                                a(1, "44") + a(3, "00") + c(1, cMain) + c(3, cMain) + t(bord(lumsz).t() + blur(lumsz).t()) +
                                                p(1) + "m 0 0 l 1 0 1 1 0 1");
                            ass_out.AppendEvent(50, "pt", t2, t3,
                                                clip(4, outlineString) + pos(lumX, lumY) +
                                                a(1, "44") + a(3, "00") + c(1, cMain) + c(3, cMain) + bord(lumsz) + blur(lumsz) +
                                                p(1) + "m 0 0 l 1 0 1 1 0 1");
                            ass_out.AppendEvent(50, "pt", t3, t4,
                                                clip(4, outlineString) + pos(lumX, lumY) +
                                                a(1, "44") + a(3, "00") + c(1, cMain) + c(3, cMain) + bord(lumsz) + blur(lumsz) +
                                                t(bord(0).t() + blur(0).t()) +
                                                p(1) + "m 0 0 l 1 0 1 1 0 1");
                        }
                        for (int i = 0; i < 30 * (t3 - t1); i++)
                        {
                            double   ptt0       = Common.RandomDouble(rnd, t1, t3);
                            double   ptt1       = ptt0 + 0.5;
                            int      pxid       = Common.RandomInt(rnd, 0, mask.Points.Count - 1);
                            ASSPoint ogpt       = mask.Points[pxid];
                            double   ptx0       = ogpt.X;
                            double   pty0       = ogpt.Y;
                            double   ptx1       = Common.RandomDouble(rnd, ptx0 - 50, ptx0 + 50);
                            double   pty1       = Common.RandomDouble(rnd, pty0 - 50, pty0 + 50);
                            string   obj        = CreatePolygon(rnd, 10, 15, 5);
                            string   moveString = Common.RandomBool(rnd, 0.75) ? move(ptx0, pty0, ptx1, pty1) : move(ptx1, pty1, ptx0, pty0);
                            ass_out.AppendEvent(20, "pt", ptt0, ptt1,
                                                moveString + a(1, "00") + a(3, "55") + c(1, "A266FD") + c(3, "A266FD") +
                                                bord(2) + blur(2) + fad(0, ptt1 - ptt0) +
                                                obj);
                            ass_out.AppendEvent(20, "pt", ptt0, ptt1,
                                                moveString + a(1, "00") + a(3, "00") + c(1, "A266FD") + c(3, "A266FD") +
                                                bord(1.2) + blur(1.2) + fad(0, ptt1 - ptt0) +
                                                obj);
                            ass_out.AppendEvent(20, "pt", ptt0, ptt1,
                                                moveString + a(1, "00") + a(3, "00") +
                                                bord(0.8) + blur(0.8) + fad(0, ptt1 - ptt0) +
                                                obj);
                        }
                    }
                    else if (isJp)
                    {
                        double t0 = ev.Start - 0.5 + iK * 0.07;
                        double t1 = kStart - 0.1;
                        double t2 = kStart + 0.4;
                        double t3 = ev.End - 0.5 + iK * 0.07;
                        double t4 = t3 + 0.5;

                        string cMain = "3C3DFF";
                        if (iEv == 2)
                        {
                            cMain = "FF8D3C";
                        }
                        if (iEv == 3)
                        {
                            cMain = "FC7D7F";
                        }
                        if (iEv == 4)
                        {
                            cMain = "FFC6D2";
                        }
                        if (iEv == 5)
                        {
                            cMain = "5758FF";
                        }
                        if (iEv == 6)
                        {
                            cMain = "5758FF";
                        }
                        if (iEv == 7)
                        {
                            cMain = "FF55C6";
                        }
                        if (iEv >= 8)
                        {
                            cMain = "FF8D3C";
                        }
                        string cShad = "EEEEEE";

                        ass_out.AppendEvent(30, evStyle, t0, t3,
                                            pos(x + 2, y + 2) + a(1, "00") + c(1, "000000") + blur(1.2) + fad(0.8, 0) +
                                            ke.KText);
                        ass_out.AppendEvent(30, evStyle, t3, t4,
                                            pos(x + 2, y + 2) + a(1, "00") + c(1, "000000") + blur(1.2) + fad(0, t4 - t3) +
                                            ke.KText);
                        ass_out.AppendEvent(40, "pt", t1, t3,
                                            clip(4, outlineString) + pos(x, y) + a(1, "33") + c(1, cShad) + fad(t2 - t1, 0) +
                                            p(1) + "m -20 -20 l 20 -20 20 20 -20 20");
                        ass_out.AppendEvent(40, "pt", t3, t4,
                                            clip(4, outlineString) + pos(x, y) + a(1, "33") + c(1, cShad) + fad(0, t4 - t3) +
                                            p(1) + "m -20 -20 l 20 -20 20 20 -20 20");
                        for (int i = 0; i < 4; i++)
                        {
                            int lumsz = 5 - i;
                            ass_out.AppendEvent(30, "pt", t1, t4,
                                                pos(0, 0) + a(1, "FF") + a(3, "DD") + blur(lumsz) + bord(lumsz) + c(3, cMain) + fad(0.3, 0.5) +
                                                p(4) + outlineString);
                        }
                        double lumX = Common.RandomInt(rnd, x - 12, x + 12);
                        double lumY = Common.RandomInt(rnd, y - 12, y + 12);
                        for (int i = 0; i < 3; i++)
                        {
                            int lumsz = 8 + i * 2;
                            ass_out.AppendEvent(50, "pt", t1, t2,
                                                clip(4, outlineString) + pos(lumX, lumY) +
                                                a(1, "44") + a(3, "00") + c(1, cMain) + c(3, cMain) + t(bord(lumsz).t() + blur(lumsz).t()) +
                                                p(1) + "m 0 0 l 1 0 1 1 0 1");
                            ass_out.AppendEvent(50, "pt", t2, t3,
                                                clip(4, outlineString) + pos(lumX, lumY) +
                                                a(1, "44") + a(3, "00") + c(1, cMain) + c(3, cMain) + bord(lumsz) + blur(lumsz) +
                                                p(1) + "m 0 0 l 1 0 1 1 0 1");
                            ass_out.AppendEvent(50, "pt", t3, t4,
                                                clip(4, outlineString) + pos(lumX, lumY) +
                                                a(1, "44") + a(3, "00") + c(1, cMain) + c(3, cMain) + bord(lumsz) + blur(lumsz) +
                                                t(bord(0).t() + blur(0).t()) +
                                                p(1) + "m 0 0 l 1 0 1 1 0 1");
                        }

                        if (iEv == 2)
                        {
                            for (double ti = t1; ti <= kEnd + 0.3; ti += 0.01)
                            {
                                double ag    = ti * Math.PI * 1.5;
                                int    iag   = (int)((ag / 2.0 / Math.PI) * 360) % 360;
                                string alpha = "00";
                                if (kEnd - ti < 0.3)
                                {
                                    alpha = Common.scaleAlpha("FF", "00", (kEnd - ti) / 0.3);
                                }
                                if (ti - t1 < 0.3)
                                {
                                    alpha = Common.scaleAlpha("FF", "00", (ti - t1) / 0.3);
                                }
                                ass_out.AppendEvent(10, "pt", ti, ti + 0.5,
                                                    pos(x, y) + a(1, alpha) + be(1) + frz(-iag) + fad(0, 0.3) +
                                                    p(1) + "m 1 0 l 0 30 -1 0 0 -30");
                            }
                        }
                        if (iEv == 3)
                        {
                            for (int i = 0; i < 15 * (t3 - t1); i++)
                            {
                                int      pxid = Common.RandomInt(rnd, 0, mask.Points.Count - 1);
                                ASSPoint ogpt = mask.Points[pxid];
                                int      ptx0 = ogpt.X;
                                int      pty0 = y;
                                double   ptt0 = Common.RandomDouble(rnd, t1, t3);
                                double   ptt1 = ptt0 + 0.1;
                                ass_out.AppendEvent(110, "pt", ptt0, ptt1,
                                                    clip(4, outlineString) + pos(ptx0, pty0) + a(1, "77") + blur(1.8) + fad(0, 0) + c(1, "000000") + frz(-30) +
                                                    p(1) + "m 2 0 l 0 20 -2 0 0 -20");
                            }
                        }
                        if (iEv == 4)
                        {
                            for (int i = 0; i < 25 * (t3 - t1); i++)
                            {
                                double   ptt0       = Common.RandomDouble(rnd, t1, t1 + 0.3);
                                double   ptt1       = ptt0 + Common.RandomDouble(rnd, 0, t3 - t1 - 0.3) + 1;
                                int      pxid       = Common.RandomInt(rnd, 0, mask.Points.Count - 1);
                                ASSPoint ogpt       = mask.Points[pxid];
                                double   ptx0       = ogpt.X;
                                double   pty0       = ogpt.Y;
                                double   ptx1       = Common.RandomDouble(rnd, ptx0 - 50, ptx0 - 150);
                                double   pty1       = Common.RandomDouble(rnd, pty0 + 10, pty0 + 50);
                                string   obj        = CreatePolygon(rnd, 7, 10, 5);
                                string   moveString = move(ptx0, pty0, ptx1, pty1, ptt1 - ptt0 - 1, ptt1 - ptt0);

                                /*ass_out.AppendEvent(110, "pt", ptt0, ptt1,
                                 *  moveString + a(1, "00") + a(3, "55") + c(1, "FFF3F3") + c(3, "FFF3F3") +
                                 *  bord(2) + blur(2) + fad(0, ptt1 - ptt0) +
                                 *  obj);*/
                                ass_out.AppendEvent(110, "pt", ptt0, ptt1,
                                                    moveString + a(1, "00") + a(3, "00") + c(1, "FFF3F3") + c(3, "FFF3F3") +
                                                    bord(1.2) + blur(1.2) + fad(0, ptt1 - ptt0) +
                                                    obj);
                                ass_out.AppendEvent(110, "pt", ptt0, ptt1,
                                                    moveString + a(1, "00") + a(3, "00") +
                                                    bord(0.8) + blur(0.8) + fad(0, ptt1 - ptt0) +
                                                    obj);
                            }
                        }
                        if (iEv == 5 || iEv == 6 || iEv == 7)
                        {
                            ass_out.AppendEvent(109, "jp", kStart, kStart + 0.15,
                                                pos(x, y) + a(1, "00") + a(3, "44") + bord(4) + blur(4) + fad(0, 0.12) +
                                                ke.KText);
                            ass_out.AppendEvent(109, "jp", kStart, kStart + 0.15,
                                                pos(x, y) + a(1, "00") + a(3, "44") + bord(6) + blur(6) + fad(0, 0.12) +
                                                ke.KText);
                            for (int i = 0; i < 2; i++)
                            {
                                CompositeCurve curve = new CompositeCurve {
                                    MinT = kStart - 0.5 * 0.25, MaxT = kStart + 0.5 * 0.25
                                };
                                Line line = new Line {
                                    X0 = x + 50 - 5 - 5, X1 = x - 50 - 5 - 5, Y0 = y - 30 - 5 - 5, Y1 = y + 30 - 5 - 5
                                };
                                if (i == 1)
                                {
                                    line = new Line {
                                        Y1 = y - 30 + i * 15 - 5, Y0 = y + 30 + i * 15 - 5, X1 = x + 50 + i * 15 - 5, X0 = x - 50 + i * 15 - 5
                                    }
                                }
                                ;
                                curve.AddCurve(curve.MinT, curve.MaxT, line);
                                List <ASSPointF> pts = curve.GetPath_Dis(1, 1.1);
                                foreach (ASSPointF pt in pts)
                                {
                                    if (!Common.InRange(0, PlayResX, pt.X) || !Common.InRange(0, PlayResY, pt.Y))
                                    {
                                        continue;
                                    }
                                    ass_out.AppendEvent(0, "pt", pt.T, pt.T + 0.25,
                                                        pos(pt.X, pt.Y) + a(1, "00") + a(3, "77") + c(1, cMain) + c(3, cMain) + fad(0, 0.1) +
                                                        bord(1.5) + blur(1.5) +
                                                        p(1) + "m 0 0 l 1 0 1 1 0 1");
                                    ass_out.AppendEvent(0, "pt", pt.T, pt.T + 0.25,
                                                        pos(pt.X, pt.Y) + a(1, "00") + a(3, "BB") + c(1, cMain) + c(3, cMain) + fad(0, 0.1) +
                                                        bord(4) + blur(4) +
                                                        p(1) + "m 0 0 l 1 0 1 1 0 1");
                                    ass_out.AppendEvent(2, "pt", pt.T, pt.T + 0.25,
                                                        pos(pt.X, pt.Y) + a(1, "00") + a(3, "44") + c(1, "FFFFFF") + c(3, "FFFFFF") + fad(0, 0.1) +
                                                        bord(1) + blur(1) +
                                                        p(1) + "m 0 0 l 1 0 1 1 0 1");
                                }
                                pts = curve.GetPath_DT(0.01);
                                foreach (ASSPointF pt in pts)
                                {
                                    if (!Common.InRange(0, PlayResX, pt.X) || !Common.InRange(0, PlayResY, pt.Y))
                                    {
                                        continue;
                                    }
                                    ass_out.AppendEvent(115, "pt", pt.T, pt.T + 0.01,
                                                        pos(pt.X, pt.Y) + a(1, "00") + a(3, "00") + c(1, "FFFFFF") + c(3, "FFFFFF") +
                                                        bord(8) + blur(8) +
                                                        p(1) + "m 0 0 l 1 0 1 1 0 1");
                                    ass_out.AppendEvent(114, "pt", pt.T, pt.T + 0.01,
                                                        pos(pt.X, pt.Y) + a(1, "00") + a(3, "00") + c(1, "FFFFFF") + c(3, "FFFFFF") +
                                                        bord(6) + blur(6) +
                                                        p(1) + "m 0 0 l 1 0 1 1 0 1");
                                }
                            }
                        }
                        if (iEv >= 8 && iEv <= 12)
                        {
                            ass_out.AppendEvent(109, "jp", kStart, kStart + 0.35,
                                                pos(x, y) + a(1, "00") + a(3, "44") + bord(4) + blur(4) + fad(0, 0.25) +
                                                ke.KText);
                            ass_out.AppendEvent(109, "jp", kStart, kStart + 0.35,
                                                pos(x, y) + a(1, "00") + a(3, "44") + bord(6) + blur(6) + fad(0, 0.25) +
                                                ke.KText);
                            string pCol = "A266FD";
                            if (iEv >= 11)
                            {
                                pCol = Common.scaleColor("FFFFFF", pCol, 0.5);
                            }
                            for (int i = 0; i < (30 + (iEv - 7) * 10) * (t3 - t1); i++)
                            {
                                double   ptt0       = Common.RandomDouble(rnd, t1, t3);
                                double   ptt1       = ptt0 + 0.5;
                                int      pxid       = Common.RandomInt(rnd, 0, mask.Points.Count - 1);
                                ASSPoint ogpt       = mask.Points[pxid];
                                double   ptx0       = ogpt.X;
                                double   pty0       = ogpt.Y;
                                double   ptx1       = Common.RandomDouble(rnd, ptx0 - 50, ptx0 + 50);
                                double   pty1       = Common.RandomDouble(rnd, pty0 - 50, pty0 + 50);
                                string   obj        = CreatePolygon(rnd, 10, 15, 5);
                                string   moveString = Common.RandomBool(rnd, 0.75) ? move(ptx0, pty0, ptx1, pty1) : move(ptx1, pty1, ptx0, pty0);
                                ass_out.AppendEvent(20, "pt", ptt0, ptt1,
                                                    moveString + a(1, "00") + a(3, "55") + c(1, pCol) + c(3, pCol) +
                                                    bord(2) + blur(2) + fad(0, ptt1 - ptt0) +
                                                    obj);
                                ass_out.AppendEvent(20, "pt", ptt0, ptt1,
                                                    moveString + a(1, "00") + a(3, "00") + c(1, pCol) + c(3, pCol) +
                                                    bord(1.2) + blur(1.2) + fad(0, ptt1 - ptt0) +
                                                    obj);
                                ass_out.AppendEvent(20, "pt", ptt0, ptt1,
                                                    moveString + a(1, "00") + a(3, "00") +
                                                    bord(0.8) + blur(0.8) + fad(0, ptt1 - ptt0) +
                                                    obj);
                            }
                        }
                    }
                    if (!isJp)
                    {
                        if (iEv == 13)
                        {
                            double t0 = kStart - 1;
                            double t1 = kStart - 0.1;
                            double t2 = kStart + 0.4;
                            double t3 = ev.End - 0.5 + iK * 0.07;
                            double t4 = t3 + 0.5;

                            string cMain  = "000071";
                            string cMain2 = "1DA4DD";// "10B7FC";

                            ass_out.AppendEvent(30, evStyle, t0, t3,
                                                pos(x + 2, y + 2) + a(1, "00") + c(1, "000000") + blur(1.2) + fad(0.8, 0) +
                                                ke.KText);
                            ass_out.AppendEvent(30, evStyle, t3, t4,
                                                pos(x + 2, y + 2) + a(1, "00") + c(1, "000000") + blur(1.2) + fad(0, t4 - t3) +
                                                ke.KText);
                            ass_out.AppendEvent(40, "pt", t1, 7 + x / ev0_sp + 0.3,
                                                clip(4, outlineString) + pos(x, y) + a(1, "33") + c(1, "222222") + fad(t2 - t1, 0.3) +
                                                p(1) + "m -20 -20 l 20 -20 20 20 -20 20");
                            ass_out.AppendEvent(40, "pt", 7 + x / ev0_sp - 0.3, t3,
                                                clip(4, outlineString) + pos(x, y) + a(1, "33") + c(1, cMain) + fad(0.3, 0) +
                                                p(1) + "m -20 -20 l 20 -20 20 20 -20 20");
                            ass_out.AppendEvent(40, "pt", t3, t4,
                                                clip(4, outlineString) + pos(x, y) + a(1, "33") + c(1, cMain) + fad(0, t4 - t3) +
                                                p(1) + "m -20 -20 l 20 -20 20 20 -20 20");
                            for (int i = 0; i < 4; i++)
                            {
                                int lumsz = 5 - i;
                                ass_out.AppendEvent(40, "pt", 7 + x / ev0_sp - 0.3, t4,
                                                    pos(0, 0) + a(1, "FF") + a(3, "DD") + blur(lumsz) + bord(lumsz) + c(3, "1D4FDD") + fad(0.3, 0.5) +
                                                    p(4) + outlineString);
                            }
                            double lumX = Common.RandomInt(rnd, x - 12, x + 12);
                            double lumY = Common.RandomInt(rnd, y - 12, y + 12);
                            for (int i = 0; i < 3; i++)
                            {
                                int lumsz  = 8 + i * 2;
                                int lumsz2 = lumsz - 1;
                                ass_out.AppendEvent(50, "pt", t1, t2,
                                                    clip(4, outlineString) + pos(lumX, lumY) +
                                                    a(1, "44") + a(3, "00") + c(1, cMain) + c(3, cMain) + t(bord(lumsz).t() + blur(lumsz).t()) +
                                                    p(1) + "m 0 0 l 1 0 1 1 0 1");
                                ass_out.AppendEvent(50, "pt", t2, 7 + x / ev0_sp + 0.3, // Speed : 200
                                                    clip(4, outlineString) + pos(lumX, lumY) + fad(0, 0.3) +
                                                    a(1, "44") + a(3, "00") + c(1, cMain) + c(3, cMain) + bord(lumsz) + blur(lumsz) +
                                                    p(1) + "m 0 0 l 1 0 1 1 0 1");
                                ass_out.AppendEvent(50, "pt", 7 + x / ev0_sp - 0.3, t3,// Speed : 200
                                                    clip(4, outlineString) + pos(lumX, lumY) + fad(0.3, 0) +
                                                    a(1, "44") + a(3, "00") + c(1, cMain2) + c(3, cMain2) + bord(lumsz2) + blur(lumsz2) +
                                                    p(1) + "m 0 0 l 1 0 1 1 0 1");
                                ass_out.AppendEvent(50, "pt", t3, t4,
                                                    clip(4, outlineString) + pos(lumX, lumY) +
                                                    a(1, "44") + a(3, "00") + c(1, cMain2) + c(3, cMain2) + bord(lumsz2) + blur(lumsz2) +
                                                    t(bord(0).t() + blur(0).t()) +
                                                    p(1) + "m 0 0 l 1 0 1 1 0 1");
                            }
                        }
                        else
                        {
                            double t0 = ev.Start - 0.5 + iK * 0.07;
                            double t1 = kStart - 0.1;
                            double t2 = kStart + 0.4;
                            double t3 = ev.End - 0.5 + iK * 0.07;
                            double t4 = t3 + 0.5;

                            string cMain = "3C3DFF";
                            int    jEv   = iEv - 13;
                            if (jEv == 1)
                            {
                                cMain = "FFFFFF";
                            }
                            if (jEv == 2)
                            {
                                cMain = "FF8D3C";
                            }
                            if (jEv == 3)
                            {
                                cMain = "FC7D7F";
                            }
                            if (jEv == 4)
                            {
                                cMain = "FFC6D2";
                            }
                            if (jEv == 5)
                            {
                                cMain = "5758FF";
                            }
                            if (jEv == 6)
                            {
                                cMain = "5758FF";
                            }
                            if (jEv == 7)
                            {
                                cMain = "FF55C6";
                            }
                            if (jEv >= 8)
                            {
                                cMain = "FF8D3C";
                            }
                            string cShad = "EEEEEE";
                            if (jEv == 1)
                            {
                                cShad = "222222";
                            }

                            ass_out.AppendEvent(30, evStyle, t0, t3,
                                                pos(x + 2, y + 2) + a(1, "00") + c(1, "000000") + blur(1.2) + fad(0.8, 0) +
                                                ke.KText);
                            ass_out.AppendEvent(30, evStyle, t3, t4,
                                                pos(x + 2, y + 2) + a(1, "00") + c(1, "000000") + blur(1.2) + fad(0, t4 - t3) +
                                                ke.KText);
                            ass_out.AppendEvent(40, "pt", t1, t3,
                                                clip(4, outlineString) + pos(x, y) + a(1, "33") + c(1, cShad) + fad(t2 - t1, 0) +
                                                p(1) + "m -20 -20 l 20 -20 20 20 -20 20");
                            ass_out.AppendEvent(40, "pt", t3, t4,
                                                clip(4, outlineString) + pos(x, y) + a(1, "33") + c(1, cShad) + fad(0, t4 - t3) +
                                                p(1) + "m -20 -20 l 20 -20 20 20 -20 20");
                            for (int i = 0; i < 4; i++)
                            {
                                int lumsz = 5 - i;
                                ass_out.AppendEvent(30, "pt", t1, t4,
                                                    pos(0, 0) + a(1, "FF") + a(3, "DD") + blur(lumsz) + bord(lumsz) + c(3, cMain) + fad(0.3, 0.5) +
                                                    p(4) + outlineString);
                            }
                            double lumX = Common.RandomInt(rnd, x - 12, x + 12);
                            double lumY = Common.RandomInt(rnd, y - 12, y + 12);
                            for (int i = 0; i < 3; i++)
                            {
                                int lumsz = 8 + i * 2;
                                ass_out.AppendEvent(50, "pt", t1, t2,
                                                    clip(4, outlineString) + pos(lumX, lumY) +
                                                    a(1, "44") + a(3, "00") + c(1, cMain) + c(3, cMain) + t(bord(lumsz).t() + blur(lumsz).t()) +
                                                    p(1) + "m 0 0 l 1 0 1 1 0 1");
                                ass_out.AppendEvent(50, "pt", t2, t3,
                                                    clip(4, outlineString) + pos(lumX, lumY) +
                                                    a(1, "44") + a(3, "00") + c(1, cMain) + c(3, cMain) + bord(lumsz) + blur(lumsz) +
                                                    p(1) + "m 0 0 l 1 0 1 1 0 1");
                                ass_out.AppendEvent(50, "pt", t3, t4,
                                                    clip(4, outlineString) + pos(lumX, lumY) +
                                                    a(1, "44") + a(3, "00") + c(1, cMain) + c(3, cMain) + bord(lumsz) + blur(lumsz) +
                                                    t(bord(0).t() + blur(0).t()) +
                                                    p(1) + "m 0 0 l 1 0 1 1 0 1");
                            }
                        }
                    }
                }

                if (iEv == 0 || iEv == 13)
                {
                    double ptx0   = MarginLeft;
                    double ptx1   = x0 + 30;
                    double pty    = y0 + FontHeight / 2;
                    string cMain  = "1DA4DD";
                    double tStart = 7;
                    for (int i = 0; i < 3; i++)
                    {
                        int lumsz = 18 + i * 2;
                        ass_out.AppendEvent(70, "pt", tStart, tStart + (ptx1 - ptx0) / ev0_sp,
                                            clip(4, outlines) + move(ptx0, pty, ptx1, pty) + fad(0.3, 0.3) +
                                            bord(lumsz) + blur(lumsz) + a(1, "44") + a(3, "00") + c(1, cMain) + c(3, cMain) +
                                            p(1) + "m 0 -20 l 1 -20 1 20 0 20");
                    }
                }
            }

            Console.WriteLine(ass_out.Events.Count);
            ass_out.SaveFile(this.OutFileName);
        }
    }
コード例 #15
0
        public override void Run()
        {
            ASS ass_in  = ASS.FromFile(this.InFileName);
            ASS ass_out = new ASS();

            ass_out.Header = ass_in.Header;
            ass_out.Events = new List <ASSEvent>();

            Random rnd = new Random();

            for (int iEv = 0; iEv < ass_in.Events.Count; iEv++)
            {
                if (iEv <= 2)
                {
                    continue;
                }

                ASSEvent ev = ass_in.Events[iEv];

                /// trick
                if (iEv == 2)
                {
                    ev.Text = ev.Text.Replace(' ', '@');
                }
                List <KElement> kelems = ev.SplitK(true);
                if (iEv == 2)
                {
                    ev.Text = ev.Text.Replace('@', ' ');
                    foreach (KElement ke in kelems)
                    {
                        ke.KText = ke.KText.Replace('@', ' ');
                    }
                }

                this.FontCharset = 1;
                this.FontName    = "EPSON 丸ゴシック体M";
                this.MaskStyle   = "Style: Default,EPSON 丸ゴシック体M,38,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,-1,0,0,0,100,100,0,0,1,0,0,5,0,0,0,1";
                string evStyle = "ed_jp";

                int tw      = GetTotalWidth(ev);
                int x0      = (PlayResX - MarginLeft - MarginRight - tw) / 2 + MarginLeft;
                int startx0 = x0;
                int y0      = PlayResY - MarginBottom - FontHeight;
                int kSum    = 0;

                List <CompositeCurve> curves      = new List <CompositeCurve>();
                List <CompositeCurve> curve_blurs = new List <CompositeCurve>();
                for (int i = 0; i < 4; i++)
                {
                    Brown brown = new Brown {
                        X0 = 0, Y0 = 0, R = 5, Speed = 100, MinT = ev.Start, MaxT = ev.End
                    };
                    CompositeCurve curve = new CompositeCurve {
                        MinT = ev.Start, MaxT = ev.End
                    };
                    curve.AddCurve(ev.Start, ev.End, brown);

                    Brown brown_blur = new Brown {
                        X0 = 0, Y0 = 0, R = 1, Speed = 5, MinT = ev.Start - 1, MaxT = ev.End + 1
                    };
                    CompositeCurve curve_blur = new CompositeCurve {
                        MinT = ev.Start - 1, MaxT = ev.End + 1
                    };
                    curve_blur.AddCurve(ev.Start - 1, ev.End + 1, brown_blur);

                    curves.Add(curve);
                    curve_blurs.Add(curve_blur);
                }

                List <int> centerOffsetX = new List <int>();
                if (iEv == 1 || iEv == 2)
                {
                    List <int> tmpx = new List <int>();
                    int        tx0  = x0;
                    for (int i = 0; i < kelems.Count; i++)
                    {
                        KElement ke    = kelems[i];
                        Size     sz    = GetSize(ke.KText);
                        int      x_an7 = x0;
                        int      y_an7 = y0;
                        tmpx.Add(tx0);
                        tx0 += sz.Width + FontSpace;
                        if (ke.KText.Trim().Length == 0)
                        {
                            continue;
                        }
                    }
                    tmpx.Add(tx0);
                    for (int i = 0; i < kelems.Count; i++)
                    {
                        KElement ke = kelems[i];
                        int      j  = i;
                        while (j + 1 < kelems.Count)
                        {
                            if (kelems[j + 1].KEnd_NoSplit == ke.KEnd_NoSplit && kelems[j + 1].KStart_NoSplit == ke.KStart_NoSplit)
                            {
                                j++;
                            }
                            else
                            {
                                break;
                            }
                        }
                        int centerx = (tmpx[i] + tmpx[j + 1]) / 2;
                        for (; i <= j; i++)
                        {
                            centerOffsetX.Add(tmpx[i] - centerx);
                        }
                        i--;
                    }
                }

                for (int iK = 0; iK < kelems.Count; iK++)
                {
                    Console.WriteLine("{0} / {1} : {2} / {3}", iEv + 1, ass_in.Events.Count, iK + 1, kelems.Count);
                    KElement ke      = kelems[iK];
                    Size     sz      = GetSize(ke.KText);
                    double   kStart  = ev.Start + kSum * 0.01;
                    double   kEnd    = kStart + ke.KValue * 0.01;
                    double   kStart0 = kStart;
                    double   kEnd0   = kEnd;
                    kSum  += ke.KValue;
                    kStart = ke.KStart_NoSplit;
                    kEnd   = ke.KEnd_NoSplit;
                    int x     = x0 + this.FontSpace + sz.Width / 2;
                    int y     = y0 + FontHeight / 2;
                    int x_an7 = x0;
                    int y_an7 = y0;
                    x0 += this.FontSpace + sz.Width;
                    if (ke.KText.Trim().Length == 0)
                    {
                        continue;
                    }

                    if (iEv == 0)
                    {
                        for (int j = 0; j < 3; j++)
                        {
                            if (j == 1)
                            {
                                x = MarginLeft + sz.Width / 2;
                            }
                            if (j == 2)
                            {
                                x = PlayResX - MarginRight - sz.Width / 2;
                            }
                            if (j != 0)
                            {
                                continue;
                            }

                            for (int i = 0; i < 4; i++)
                            {
                                CompositeCurve curve      = curves[i];
                                CompositeCurve curve_blur = curve_blurs[i];

                                foreach (ASSPointF pt in curve.GetPath_DT(0.04))
                                {
                                    ASSPointF pt_blur = curve_blur.GetPointF(pt.T);
                                    string    a1      = "22";
                                    if (pt.T - ev.Start < 0.3)
                                    {
                                        a1 = Common.scaleAlpha("FF", "22", (pt.T - ev.Start) / 0.3);
                                    }
                                    if (ev.End - pt.T < 0.3)
                                    {
                                        a1 = Common.scaleAlpha("FF", "22", (ev.End - pt.T) / 0.3);
                                    }

                                    ass_out.AppendEvent(50, evStyle, pt.T, pt.T + 0.04,
                                                        pos(pt.X + x, pt.Y + y) +
                                                        a(1, a1) +
                                                        c(1, (i % 2 == 0) ? "FFFFFF" : "000000") +
                                                        blur(5.0 * ((pt_blur.X + 1.1) * 0.5)) +
                                                        ke.KText);
                                }
                            }
                        }
                    }

                    if (iEv == 1 || iEv == 2)
                    {
                        for (int i = 0; i < 2; i++)
                        {
                            CompositeCurve curve      = curves[i];
                            CompositeCurve curve_blur = curve_blurs[i];

                            foreach (ASSPointF pt in curve.GetPath_DT(0.04))
                            {
                                ASSPointF pt_blur = curve_blur.GetPointF(pt.T);
                                string    a1      = "22";
                                if (pt.T - ev.Start < 0.3)
                                {
                                    a1 = Common.scaleAlpha("FF", "22", (pt.T - ev.Start) / 0.3);
                                }
                                if (ev.End - pt.T < 0.3)
                                {
                                    a1 = Common.scaleAlpha("FF", "22", (ev.End - pt.T) / 0.3);
                                }

                                double blur_value = 2.0 * ((pt_blur.X + 2) * 0.5);
                                int    ifsc       = 100;
                                double kEnd2      = kEnd;
                                bool   ink        = false;
                                if (pt.T >= kStart && pt.T <= kEnd2)
                                {
                                    ifsc = 135;
                                    ink  = true;
                                }
                                string col = (i % 2 == 0) ? "FFFFFF" : "000000";
                                if (i % 2 == 0 && ink)
                                {
                                    col = "FFFFFF";
                                    a1  = "00";
                                }
                                else
                                {
                                    a1 = "77";
                                }

                                ass_out.AppendEvent((i == 0) ? (ink ? 150 : 50) : 100, evStyle, pt.T, pt.T + 0.04,
                                                    pos(pt.X + x + (double)(ifsc - 100) / 100.0 * centerOffsetX[iK], pt.Y + y) +
                                                    a(1, a1) +
                                                    c(1, col) +
                                                    blur(blur_value) + fsc(ifsc) +
                                                    ke.KText);

                                if (i == 1)
                                {
                                    continue;
                                }
                                double tx  = pt.X + x;
                                double dx  = -(pt.T - kStart0) / ev.Last * 10.0;
                                double ta1 = 1;
                                if (!ink)
                                {
                                    ta1 = 0.5;
                                }
                                if (pt.T - ev.Start < 0.3)
                                {
                                    ta1 *= (pt.T - ev.Start) / 0.3;
                                }
                                if (ev.End - pt.T < 0.3)
                                {
                                    ta1 *= (ev.End - pt.T) / 0.3;
                                }
                                double tb   = blur_value;
                                int    tfsc = ifsc + 5;
                                for (int j = 0; j < 10; j++)
                                {
                                    ass_out.AppendEvent(50 + j + 1, evStyle, pt.T, pt.T + 0.04,
                                                        pos(tx + (double)(tfsc - 100) / 100.0 * centerOffsetX[iK], pt.Y + y) +
                                                        a(1, Common.scaleAlpha("FF", "00", ta1)) +
                                                        c(1, col) +
                                                        blur(tb) + fsc(tfsc) +
                                                        ke.KText);

                                    tx += dx;
                                    if (dx < 0)
                                    {
                                        dx -= 1.0;
                                    }
                                    else
                                    {
                                        dx += 1.0;
                                    }
                                    ta1  *= 0.9;
                                    tb   += 1;
                                    tfsc += (int)Math.Abs(dx);
                                }
                            }
                        }
                    }

                    if (iEv > 2)
                    {
                        ass_out.AppendEvent(49, evStyle, ev.Start, ev.End,
                                            pos(x - 1, y - 1) +
                                            a(1, "00") + c(1, "000000") + blur(1.1) +
                                            ke.KText);
                        ass_out.AppendEvent(50, evStyle, ev.Start, ev.End,
                                            pos(x, y) +
                                            a(1, "00") + c(1, "000000") + blur(0.9) +
                                            ke.KText);
                        ass_out.AppendEvent(51, evStyle, ev.Start, ev.End,
                                            pos(x + 2, y + 2) +
                                            a(1, "00") + c(1, "000000") +
                                            ke.KText);
                    }
                }
            }

            ass_out.SaveFile(OutFileName);
            Console.WriteLine("Lines : {0}", ass_out.Events.Count);
        }
コード例 #16
0
        public override void Run()
        {
            ASS ass_in  = ASS.FromFile(this.InFileName);
            ASS ass_out = new ASS()
            {
                Header = ass_in.Header, Events = new List <ASSEvent>()
            };

            /*
             * foreach (Beat bt in GetBeats())
             *  ass_out.AppendEvent(0, "op_jp", bt.Time, bt.Time + 0.4,
             *      pos(50, 30) + a(1, "00") + c(3, "00") + bord(2) + blur(2) + fad(0, 0.3) +
             *      bt.Id.ToString());
             * */

            for (int iEv = 0; iEv < ass_in.Events.Count; iEv++)
            {
                if (iEv == 19)
                {
                    continue;
                }
                bool isJp = iEv <= 9 || iEv == 19;
                int  jEv  = (iEv >= 10) ? iEv - 10 : iEv;
                if (iEv != 0)
                {
                    continue;
                }
                //if (!isJp) continue;
                //if (iEv != 0 && iEv != 10) continue;
                this.FontHeight = isJp ? 23 : 25;
                this.FontSpace  = isJp ? 1 : 1;
                this.MaskStyle  = isJp ?
                                  "Style: Default,DFSoGei-W7,23,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,0,0,0,0,100,100,0,0,1,0,0,5,0,0,0,128" :
                                  "Style: Default,方正综艺_GBK,25,&H00FFFFFF,&HFFFFFFFF,&HFFFFFFFF,&HFFFFFFFF,0,0,0,0,100,100,0,0,1,0,0,5,0,0,0,1";
                ASSEvent        ev     = ass_in.Events[iEv];
                List <KElement> kelems = ev.SplitK(true);
                int             x0     = (PlayResX - MarginLeft - MarginRight - GetTotalWidth(ev)) / 2 + MarginLeft;
                int             y0     = (iEv <= 9) ? (PlayResY - MarginBottom - FontHeight) : MarginTop;
                int             kSum   = 0;

                List <KeyValuePair <double, ASSPoint> > textpath = new List <KeyValuePair <double, ASSPoint> >();
                string outlines = "";
                double lastt0   = -1;
                for (int iK = 0; iK < kelems.Count; iK++)
                {
                    //if (iK > 0) break;
                    Console.WriteLine("{0} / {1} : {2} / {3}", iEv + 1, ass_in.Events.Count, iK + 1, kelems.Count);
                    string   evStyle         = isJp ? "op_jp" : "op_cn";
                    string   ptStyle         = "op_pt";
                    string   outlineFontname = isJp ? "DFSoGei-W7" : "方正综艺_GBK";
                    int      outlineEncoding = isJp ? 128 : 1;
                    KElement ke     = kelems[iK];
                    Size     sz     = GetSize(ke.KText);
                    double   kStart = ev.Start + kSum * 0.01;
                    double   kEnd   = kStart + ke.KValue * 0.01;
                    kSum += ke.KValue;
                    int        x     = x0 + this.FontSpace + sz.Width / 2;
                    int        y     = y0 + FontHeight / 2;
                    int        x_an7 = x0;
                    int        y_an7 = y0;
                    StringMask mask  = GetMask(ke.KText, x, y);
                    if (ke.KText.Trim().Length == 0)
                    {
                        sz.Width = 20;
                    }
                    x0 += this.FontSpace + sz.Width;
                    if (ke.KText.Trim().Length == 0)
                    {
                        continue;
                    }
                    int xOffset = 0;
                    if (!isJp)
                    {
                        xOffset = 1;
                    }
                    else if (iEv == 9 || iEv == 19)
                    {
                        xOffset = 5;
                    }
                    string outlineString = GetOutline(x - FontHeight / 2 + xOffset, y - FontHeight / 2, ke.KText[0], outlineFontname, outlineEncoding, FontHeight, 0, 156);
                    outlines += " " + outlineString;

                    textpath.Add(new KeyValuePair <double, ASSPoint>(kStart, new ASSPoint {
                        X = x, Y = y, Start = kStart, End = kEnd
                    }));

                    double t0 = ev.Start - 0.5 + iK * 0.1;
                    if (iEv == 9 || iEv == 19)
                    {
                        t0 = ev.Start - 0.5 + iK * 0.04;
                    }
                    double t1 = t0 + 0.5;
                    double t2 = kStart;
                    double t3 = kEnd;
                    double t4 = ev.End - 0.5 + iK * 0.1;
                    double t5 = t4 + 0.5;
                    if (iEv == 9 || iEv == 19)
                    {
                        t4 = ev.End - 0.5 + iK * 0.04;
                    }
                    lastt0 = t0;

                    /*
                     * ass_out.AppendEvent(10, ptStyle, ev.Start, ev.End,
                     *  pos(0, 0) + a(1, "00") + c(1, "0000FF") +
                     *  p(4) + outlineString);
                     * ass_out.AppendEvent(0, evStyle, ev.Start, ev.End,
                     *  pos(x, y) + a(1, "00") +
                     *  ke.KText);
                     * continue;
                     * */

                    string mainColor = Common.scaleColor("C67A82", "C6A87A", (double)iK / (double)(kelems.Count - 1));
                    string shadColor = Common.scaleColor("77333B", "775D33", 1.0 - (double)iK / (double)(kelems.Count - 1));
                    shadColor = Common.scaleColor("000000", shadColor, 0.7);
                    if (iEv <= 9)
                    {
                        shadColor = "FFFFFF";
                    }
                    string backColor = "FFFFFF";

                    string mainColor2 = "4A45AB";
                    string shadColor2 = "353377";
                    if ((isJp && iEv > 4) || (!isJp && iEv - 10 > 4))
                    {
                        string tmp = mainColor;
                        mainColor  = mainColor2;
                        mainColor2 = tmp;
                        tmp        = shadColor;
                        shadColor  = shadColor2;
                        shadColor2 = tmp;
                    }
                    if (iEv > 9)
                    {
                        mainColor2 = mainColor;
                        shadColor2 = shadColor;
                    }

                    if (iEv <= 9)
                    {
                        foreach (Beat bt in GetBeats())
                        {
                            if (bt.Time <= t0 || bt.Time >= t4)
                            {
                                continue;
                            }
                            string btCol = bt.Time <= t2 ? shadColor : shadColor2;
                            if (jEv <= 4)
                            {
                                ass_out.AppendEvent(40, evStyle, bt.Time, bt.Time + 0.4,
                                                    pos(x, y) + fad(0, 0.3) +
                                                    a(3, "00") + c(3, btCol) + ybord(3) + blur(2.5) +
                                                    ke.KText);
                            }
                            else
                            {
                                ass_out.AppendEvent(40, evStyle, bt.Time, bt.Time + 0.4,
                                                    pos(x, y) + fad(0, 0.3) +
                                                    a(3, "00") + c(3, btCol) + xbord(6) + blur(4.5) +
                                                    ke.KText);
                            }
                        }

                        ass_out.AppendEvent(45, evStyle, t0, t2 + 0.5,
                                            pos(x, y) + fad(t1 - t0, 0.5) +
                                            a(1, "00") + c(1, backColor) + a(3, "00") + c(3, shadColor) + bord(1.5) + blur(1.5) +
                                            ke.KText);
                        ass_out.AppendEvent(45, evStyle, t2, t5,
                                            pos(x, y) + fad(0.5, t5 - t4) +
                                            a(1, "00") + c(1, backColor) + a(3, "00") + c(3, shadColor2) + bord(1.5) + blur(1.5) +
                                            ke.KText);
                    }
                    else
                    {
                        ass_out.AppendEvent(45, evStyle, t0, t5,
                                            pos(x, y) + fad(t1 - t0, t5 - t4) +
                                            a(1, "00") + c(1, backColor) + a(3, "00") + c(3, shadColor) + bord(1.5) + blur(1.5) +
                                            ke.KText);
                    }
                    for (int i = 0; i < ((iEv == 9 || iEv == 19) ? 1 : 3); i++)
                    {
                        double rndRange = (iEv == 9 || iEv == 19) ? 8 : (isJp ? 12 : 11);
                        double ptx0     = Common.RandomDouble(rnd, x - rndRange, x + rndRange);
                        double pty0     = Common.RandomDouble(rnd, y - rndRange, y + rndRange);
                        double bordSz   = isJp ? 5 : 4.5;
                        double blurSz   = isJp ? 4.5 : 4.2;
                        if (iEv <= 9)
                        {
                            ass_out.AppendEvent(50, ptStyle, t0, t2 + 0.5,
                                                pos(ptx0, pty0) + fad(t1 - t0, 0.5) + clip(4, outlineString) +
                                                a(1, "44") + a(3, "00") + c(1, mainColor) + c(3, mainColor) + bord(bordSz) + blur(blurSz) +
                                                p(1) + "m 0 0 l 1 0 1 1 0 1");
                            ass_out.AppendEvent(50, ptStyle, t2, t5,
                                                pos(ptx0, pty0) + fad(0.5, t5 - t4) + clip(4, outlineString) +
                                                a(1, "44") + a(3, "00") + c(1, mainColor2) + c(3, mainColor2) + bord(bordSz) + blur(blurSz) +
                                                p(1) + "m 0 0 l 1 0 1 1 0 1");
                        }
                        else
                        {
                            ass_out.AppendEvent(50, ptStyle, t0, t5,
                                                pos(ptx0, pty0) + fad(t1 - t0, t5 - t4) + clip(4, outlineString) +
                                                a(1, "44") + a(3, "00") + c(1, mainColor) + c(3, mainColor) + bord(bordSz) + blur(blurSz) +
                                                p(1) + "m 0 0 l 1 0 1 1 0 1");
                        }
                    }

                    if (iEv > 9)
                    {
                        continue;
                    }

                    ass_out.AppendEvent(70, evStyle, t2, t2 + 0.4,
                                        pos(x, y) + fad(0.00, 0.28) +
                                        a(1, "00") + a(3, "00") + bord(3) + blur(2.8) +
                                        ke.KText);
                }

                if (iEv > 9)
                {
                    continue;
                }

                for (int i = 0; i < textpath.Count - 1; i++)
                {
                    if (textpath[i].Value.End < textpath[i + 1].Value.Start)
                    {
                        textpath[i].Value.End = textpath[i + 1].Value.Start;
                    }
                }
                textpath[textpath.Count - 1].Value.End = ev.End;

                emitterList = new List <ASSPointF>();
                foreach (KeyValuePair <double, ASSPoint> pair in textpath)
                {
                    emitterList.Add(new ASSPointF
                    {
                        Start = pair.Value.Start,
                        End   = pair.Value.End,
                        X     = pair.Value.X + Common.RandomDouble(rnd, -20, 20),
                        Y     = pair.Value.Y + Common.RandomDouble(rnd, -20, 20)
                    });
                }

                forceCurve = new CompositeCurve {
                    MinT = ev.Start, MaxT = ev.End + 10
                };
                double lastag = 0;
                for (double time = forceCurve.MinT; time <= forceCurve.MaxT; time += 0.7)
                {
                    double ag = Common.RandomDouble(rnd, 0, Math.PI * 2);
                    while (Math.Abs(ag - lastag) < Math.PI * 0.5 || Math.Abs(ag - lastag) > Math.PI * 1.5)
                    {
                        ag = Common.RandomDouble(rnd, 0, Math.PI * 2);
                    }
                    lastag = ag;
                    double x = 1000.0 * Math.Cos(ag);
                    double y = 600.0 * Math.Sin(ag);
                    forceCurve.AddCurve(time, time + 0.7, new Line {
                        X0 = x, Y0 = y, X1 = 0, Y1 = 0, Acc = 0.7
                    });
                }

                NumberPerSecond = 20;
                XXParticleSystem xxps = new XXParticleSystem();
                xxps.Emitter                = this;
                xxps.ForceField             = this;
                xxps.StartTime              = ev.Start;
                xxps.EndTime                = ev.End;
                xxps.InterpolationPrecision = 0.03;
                xxps.Resistance             = 0.04;
                xxps.Repulsion              = -4500;
                xxps.Gravity                = 0;
                xxps.GravityPosition        = this;

                xxps.InterpolationPrecision = 0.01;
                List <KeyValuePair <XXParticleElement, List <string> > > result = xxps.RenderT();
                foreach (KeyValuePair <XXParticleElement, List <string> > pair in result)
                {
                    string s     = CreatePolygon(rnd, 9, 9, 4);
                    string ptstr = @"{\p1}m 0 0 l 1 0 1 1 0 1";
                    string ptcol = (iEv <= 4) ? "532BFF" : "FFC0C6";
                    ass_out.AppendEvent(20, "op_pt", pair.Key.Born, pair.Key.Born + pair.Key.Life,
                                        pos(-100, -100) +
                                        pair.Value[1] +
                                        ptstr + "\\N" + r() +
                                        pair.Value[0] +
                                        ptstr + r() +
                                        a(1, "22") + a(3, "77") + blur(2.5) + bord(2) + c(3, ptcol) +
                                        //a(4, "44") + @"{\shad1}" + c(4, "FFFFFF") +
                                        s);
                }

                if (isJp)
                {
                    double ptx0 = textpath[0].Value.X - 50;
                    double ptx1 = textpath.Last().Value.X + 50;
                    double pty0 = textpath[0].Value.Y;
                    double spd  = 400;
                    foreach (Beat bt in GetBeats())
                    {
                        if (iEv == 9)
                        {
                            double ptt0 = bt.Time - 0.15;
                            if (ptt0 < ev.Start || ptt0 >= ev.End - 0.4)
                            {
                                continue;
                            }
                            ass_out.AppendEvent(200, "op_pt", ptt0, ptt0 + (ptx1 - ptx0) / spd,
                                                (iEv % 2 == 0 ? move(ptx1, pty0, ptx0, pty0) : move(ptx0, pty0, ptx1, pty0)) + clip(4, outlines) +
                                                a(1, "00") + blur(3) + frz(-45) + fscx(70) +
                                                p(1) + "m -15 -30 l 15 -30 15 30 -15 30");
                        }
                        else
                        {
                            double ptt0 = lastt0;
                            ass_out.AppendEvent(200, "op_pt", ptt0, ptt0 + (ptx1 - ptx0) / spd,
                                                move(ptx1, pty0, ptx0, pty0) + clip(4, outlines) +
                                                a(1, "00") + blur(3) + frz(-45) + fscx(70) +
                                                p(1) + "m -15 -30 l 15 -30 15 30 -15 30");
                            ass_out.AppendEvent(200, "op_pt", ptt0, ptt0 + (ptx1 - ptx0) / spd,
                                                move(ptx0, pty0, ptx1, pty0) + clip(4, outlines) +
                                                a(1, "00") + blur(3) + frz(-45) + fscx(70) +
                                                p(1) + "m -15 -30 l 15 -30 15 30 -15 30");
                            break;
                        }
                    }
                }
            }

            Console.WriteLine(ass_out.Events.Count);
            ass_out.SaveFile(this.OutFileName);
        }