コード例 #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);
        }
    }
        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);
        }
コード例 #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);
        }
コード例 #4
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);
        }
    }