コード例 #1
0
        /// <summary>
        /// \t, X, Y. 默认pos(-100, -100)
        /// </summary>
        /// <returns></returns>
        public List <KeyValuePair <XXParticleElement, List <string> > > RenderT()
        {
            List <KeyValuePair <XXParticleElement, List <string> > > result = new List <KeyValuePair <XXParticleElement, List <string> > >();

            foreach (KeyValuePair <XXParticleElement, List <ASSPointF> > pair in RenderPoint())
            {
                foreach (ASSPointF pt in pair.Value)
                {
                    pt.X += 100;
                    pt.Y += 100;
                }
                StringBuilder sbx = new StringBuilder();
                StringBuilder sby = new StringBuilder();
                for (int i = 0; i < pair.Value.Count; i += 10)
                {
                    List <ASSPointF> ptList = new List <ASSPointF>();
                    for (int j = i; j < i + 10 && j < pair.Value.Count; j++)
                    {
                        ptList.Add(pair.Value[j]);
                    }
                    if (ptList.Count > 0 && i == 0)
                    {
                        sbx.Append(ASSEffect.fscx((int)(ptList[0].X * 100)));
                        sby.Append(ASSEffect.fscy((int)(ptList[0].Y * 100)));
                    }
                    sbx.Append(ASSEffect.t(ptList[0].T - pair.Key.Born, ptList[ptList.Count - 1].T - pair.Key.Born + InterpolationPrecision, ASSEffect.fscx((int)(ptList[ptList.Count - 1].X * 100)).t()));
                    sby.Append(ASSEffect.t(ptList[0].T - pair.Key.Born, ptList[ptList.Count - 1].T - pair.Key.Born + InterpolationPrecision, ASSEffect.fscy((int)(ptList[ptList.Count - 1].Y * 100)).t()));
                }
                List <string> tmp = new List <string>();
                tmp.Add(sbx.ToString());
                tmp.Add(sby.ToString());
                result.Add(new KeyValuePair <XXParticleElement, List <string> >(pair.Key, tmp));
            }
            return(result);
        }
コード例 #2
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";

            char       ch   = '雨';
            int        x    = 300;
            int        y    = 300;
            double     r0   = 15;
            double     r1   = 30;
            string     col1 = "FFFC94";
            string     col2 = "FF94D1";
            string     col3 = "FFFFFF";
            StringMask mask = GetMask(ch + "", x, y);

            double t0 = 0;
            double t3 = 10;

            ass_out.AppendEvent(0, "Default", t0, t3,
                                ASSEffect.pos(x, y) + ASSEffect.a(1, "FF") + ASSEffect.c(1, col2) +
                                ASSEffect.a(3, "FF") +
                                ch);
            for (int i = 0; i < 1; i++)
            {
                ass_out.AppendEvent(0, "Default", t0, t3,
                                    ASSEffect.pos(x, y) + ASSEffect.a(1, "00") + ASSEffect.c(1, col2) +
                                    ASSEffect.org(x - 200, y) + ASSEffect.t(0, t3 - t0, ASSEffect.fry(-360).t()) +
                                    ASSEffect.a(3, "FF") + ASSEffect.be(1) + ASSEffect.bord(0) +
                                    ASSEffect.t(0, (t3 - t0) * 0.125, ASSEffect.fscx(30).t()) +
                                    ASSEffect.t((t3 - t0) * 0.125, (t3 - t0) * 0.125 * 2, ASSEffect.fscx(100).t()) +
                                    ASSEffect.t(0, (t3 - t0) * 0.25, ASSEffect.fscy(40).t()) +
                                    ASSEffect.bord(1) +
                                    ch);
            }

            /*
             * for (int agi = 0; agi < 360; agi += 20)
             * {
             *  double x0 = x + r0 * Math.Cos(0);
             *  double y0 = y + r0 * Math.Sin(0);
             *  double x1 = x + r1 * Math.Cos(0);
             *  double y1 = y + r1 * Math.Sin(0);
             *
             *  double t0 = 1;
             *  double t1 = t0 + 1.8;
             *
             *  ass_out.AppendEvent(2, "pt", t0, t1,
             *      ASSEffect.an(5) +
             *      ASSEffect.move(x0, y0, x1, y1) + ASSEffect.org(x, y) + ASSEffect.frz(agi) +
             *      ASSEffect.a(1, "00") + ASSEffect.c(1, "FFFFFF") +
             *      ASSEffect.a(3, "44") + ASSEffect.c(3, "FFFFFF") +
             *      ASSEffect.t(0, t1 - t0, ASSEffect.frz(agi + 360).t()) +
             *      ASSEffect.ybord(10) + ASSEffect.xbord(0) + ASSEffect.be(1) +
             *      ptstr);
             *
             *  ass_out.AppendEvent(2, "pt", t0, t1,
             *      ASSEffect.an(5) +
             *      ASSEffect.move(x0, y0, x1, y1) + ASSEffect.org(x, y) + ASSEffect.frz(agi) +
             *      ASSEffect.a(1, "00") + ASSEffect.c(1, "FFFFFF") +
             *      ASSEffect.a(3, "22") + ASSEffect.c(3, col1) +
             *      ASSEffect.t(0, t1 - t0, ASSEffect.frz(agi + 360).t()) +
             *      ASSEffect.ybord(11) + ASSEffect.xbord(0) + ASSEffect.blur(2) +
             *      ptstr);
             * }
             * */

            ass_out.SaveFile(OutFileName);
        }