public override ASSPointF GetPointF(double t) { List <ASSPointF> tmp = new List <ASSPointF>(); while (tmp.Count < 10) { ASSPointF p = OriginalCurve.GetPointF(Common.RandomDouble(rnd, t - BlurRange, t + BlurRange)); if (p != null) { tmp.Add(p); } } ASSPointF pt = new ASSPointF { X = 0, Y = 0, T = t }; foreach (ASSPointF tmppt in tmp) { pt.X += tmppt.X; pt.Y += tmppt.Y; } pt.X /= (double)tmp.Count; pt.Y /= (double)tmp.Count; return(pt); }
public override void Run() { string ptstr = @"{\p1}m 0 0 l -31 2 -53 10 -67 7 -53 9 -32 1 -41 -2 -49 -2 -54 -1 -49 -3 -41 -3 -46 -7 -49 -23 -45 -8 -41 -4 -32 0 -29 1 -26 1 -23 1 -10 0 -21 -8 -28 -12 -35 -11 -28 -13 -21 -9 -10 -1 -4 -14 5 -19 13 -25 13 -33 18 -37 24 -35 25 -29 23 -34 18 -36 14 -33 14 -25 10 -22 20 -17 20 -9 13 -5 19 -9 19 -17 9 -21 6 -19 -3 -13 -9 -1 0 -1 25 4 43 2 54 15 43 3 36 3 38 12 47 25 37 13 35 4 25 5 12 3 -8 22 -31 25 -41 32 -32 24 -9 21 11 3"; ASS ass_in = ASS.FromFile(this.InFileName); ASS ass_out = new ASS(); ass_out.Header = ass_in.Header; ass_out.Events = new List <ASSEvent>(); int ox = 424; int oy = 240; Random rnd = new Random(); double tStart = 1; double tEnd = 10; double particlePerSec = 200; string mainCol = "FF205C"; CompositeCurve curve = Line.Create1(424 - 20, 240 - 20, 424 + 20, 240 + 20, 100, tStart, tEnd); for (int iP = 0; iP < particlePerSec * (tEnd - tStart); iP++) { double t0 = Common.RandomDouble(rnd, tStart, tEnd); double life = 0.3; double t1 = t0 + life; double tmpt = (double)iP / (particlePerSec * (tEnd - tStart)) * (tEnd - tStart) + tStart; ASSPointF orgpt = curve.GetPointF(tmpt); double x0 = orgpt.X; double y0 = orgpt.Y; double ag = Common.RandomDouble(rnd, 0, 2 * Math.PI); double r = 40; double x1 = x0 + r * Math.Cos(ag); double y1 = y0 + r * Math.Sin(ag); int tmpz = Common.RandomInt(rnd, 100, 200) * Common.RandomSig(rnd); tmpz = Common.RandomInt(rnd, 0, 359); for (int i = 0; i < 1; i++) { ass_out.AppendEvent(10 + i, "pt", t0, t1, move(x0, y0, x1, y1, 0, life * 0.7) + a(1, "77") + a(3, "DD") + fad(0, life * 0.8) + c(1, mainCol) + c(3, mainCol) + bord(3 - i) + be(3 - i) + fsc(30, 30) + t(life * 0.5, life, fsc(0, 0).t()) + frz(tmpz) + ptstr); } ass_out.AppendEvent(20, "pt", t0, t1, move(x0, y0, x1, y1, 0, life * 0.7) + a(1, "77") + a(3, "DD") + fad(0, life * 0.8) + c(1, "FFFFFF") + c(3, "FFFFFF") + bord(2) + blur(2) + fsc(30, 30) + t(life * 0.5, life, fsc(0, 0).t()) + frz(tmpz) + ptstr); } ass_out.SaveFile(OutFileName); }
public string Move(double t0, double t1) { ASSPointF p0 = GetPointF(t0); ASSPointF p1 = GetPointF(t1); if (p0 == null || p1 == null) { throw new Exception(); } return(ASSEffect.move(p0, p1)); }
public override ASSPointF GetPointF(double t) { ASSPointF pt = new ASSPointF { X = (Math.Pow(1 - t, 3) * P0.X + 3.0 * Math.Pow(1 - t, 2) * t * P1.X + 3.0 * (1 - t) * Math.Pow(t, 2) * P2.X + Math.Pow(t, 3) * P3.X), Y = (Math.Pow(1 - t, 3) * P0.Y + 3.0 * Math.Pow(1 - t, 2) * t * P1.Y + 3.0 * (1 - t) * Math.Pow(t, 2) * P2.Y + Math.Pow(t, 3) * P3.Y), T = t }; return(pt); }
public List <ASSEvent> Create(IMovingObject imo) { List <ASSEvent> result = new List <ASSEvent>(); //string pt0Str = @"{\blur3\bord4\p4}m 10 10 s 10 -10 -10 -10 -10 10"; string pt0Str = @"{\blur" + (Pt0Size - 1) + @"\bord" + Pt0Size + @"\p4}m 10 10 s 10 -10 -10 -10 -10 10"; string pt1Str = @"{\p4}m 0 100 l 1 1 100 0 1 -1 0 -100 -1 -1 -100 0 -1 1"; for (double time = ParticleStartTime; time < ParticleEndTime; time += TimeStep) { for (int iDot = 0; iDot < ParticlePerStep; iDot++) { ASSPointF orgP = imo.GetPosition(time); double orgX = orgP.X; double orgY = orgP.Y; ParticleDot dot = new ParticleDot(orgX, orgY, Common.RandomDouble(rnd, MinDX, MaxDX), Common.RandomDouble(rnd, MinDY, MaxDY), -Common.RandomDouble(rnd, MinDA, MaxDA)); double liveTime = -1.0 / dot.dA; double startTime = time; double endTime = time + liveTime; double xEnd = dot.X + dot.dX * liveTime; double yEnd = dot.Y + dot.dY * liveTime; result.Add(new ASSEvent { Effect = "", Layer = 0, MarginL = "0000", MarginR = "0000", MarginV = "0000", Name = "NTP", Style = "Default", Start = startTime, End = endTime, Text = ASSEffect.move(dot.X, dot.Y, xEnd, yEnd) + ASSEffect.a(1, "FF") + ASSEffect.c(3, ColorStart) + ASSEffect.fad(0, liveTime) + ASSEffect.t(0, liveTime, ASSEffect.c(3, ColorEnd).t()) + pt0Str }); if (Star) { result.Add(new ASSEvent { Effect = "", Layer = 0, MarginL = "0000", MarginR = "0000", MarginV = "0000", Name = "NTP", Style = "Default", Start = startTime, End = endTime, Text = ASSEffect.move(dot.X, dot.Y - 1, xEnd, yEnd - 1) + ASSEffect.a(1, "77") + ASSEffect.c(1, ColorStart) + ASSEffect.fad(0, liveTime) + ASSEffect.t(0, liveTime, ASSEffect.c(1, ColorEnd).t()) + pt1Str }); } } } return(result); }
public ASSPointF GetPosition(double time) { double ra = (time - StartTime) / (EndTime - StartTime); ASSPointF org = new ASSPointF { X = (X1 - X0) * ra + X0, Y = (Y1 - Y0) * ra + Y0 }; double t = Common.RandomDouble_Gauss(rnd, MinT, MaxT, GaussRnd); ASSPointF p = new ASSPointF { X = org.X + R * Math.Cos(t), Y = org.Y + R * Math.Sin(t) }; return(p); }
public List <ASSPointF> GetPath_DT(double dt) { List <ASSPointF> result = new List <ASSPointF>(); for (double t = MinT; t <= MaxT; t += dt) { result.Add(GetPointF(t)); } ASSPointF ed = GetPointF(MaxT); if (ed != null && result[result.Count - 1].GetDis(ed) > 1) { result.Add(ed); } return(result); }
public ASSPointF GetPosition(double time) { double r = (time - StartTime) / (EndTime - StartTime); ASSPointF p = new ASSPointF { X = (X1 - X0) * r + X0, Y = (Y1 - Y0) * r + Y0 }; if (MinDX < MaxDX) { p.X += Common.RandomDouble(rnd, MinDX, MaxDX); } if (MinDY < MaxDY) { p.Y += Common.RandomDouble(rnd, MinDY, MaxDY); } return(p); }
public ASSPointF GetPosition(double time) { double ra = (time - StartTime) / (EndTime - StartTime); double x = (X1 - X0) * ra + X0; ASSPointF p = new ASSPointF { X = x, Y = Y0 + H * Math.Sin(K * x) }; if (MinDX < MaxDX) { p.X += Common.RandomDouble(rnd, MinDX, MaxDX); } if (MinDY < MaxDY) { p.Y += Common.RandomDouble(rnd, MinDY, MaxDY); } return(p); }
public ASSPointF GetPosition(double time) { double ra = (time - StartTime) / (EndTime - StartTime); double t = StartT + ra * 2.0 * Math.PI; ASSPointF p = new ASSPointF { X = X0 + R * Math.Cos(t), Y = Y0 + R * Math.Sin(t) }; if (MinDX < MaxDX) { p.X += Common.RandomDouble(rnd, MinDX, MaxDX); } if (MinDY < MaxDY) { p.Y += Common.RandomDouble(rnd, MinDY, MaxDY); } return(p); }
public override ASSPointF GetPointF(double t) { ASSPointF pt = new ASSPointF { X = 0, Y = 0, T = t }; foreach (CompositeCurve_Element elem in Curves) { BaseCurve curve = elem.Curve; ASSPointF pt0 = elem.Curve.GetPointF((t - MinT) / (MaxT - MinT) * (curve.MaxT - curve.MinT) + curve.MinT); if (pt0 == null) { return(null); } pt.X += pt0.X; pt.Y += pt0.Y; } return(pt); }
public override ASSPointF GetPointF(double t) { foreach (CompositeCurve_Element elem in Curves) { if (Common.InRange(elem.StartT, elem.EndT, t)) { BaseCurve curve = elem.Curve; ASSPointF pt = curve.GetPointF((t - elem.StartT) / (elem.EndT - elem.StartT) * (curve.MaxT - curve.MinT) + curve.MinT); pt.T = (pt.T - curve.MinT) / (curve.MaxT - curve.MinT) * (elem.EndT - elem.StartT) + elem.StartT; return(pt); } } return(null); if (t < Curves_MinT) { return(Curves_Min.Curve.GetMinPointF()); } if (t > Curves_MaxT) { return(Curves_Max.Curve.GetMaxPointF()); } throw new Exception(); }
public List <ASSPointF> GetPath_Dis(double mindis, double maxdis) { List <ASSPointF> result = new List <ASSPointF>(); ASSPointF last = GetPointF(MinT); result.Add(last); double dt = (MaxT - MinT) / 100.0; double t = MinT; bool b0 = false; bool b1 = false; ASSPointF ed = GetPointF(MaxT); while (t <= MaxT) { ASSPointF pt = GetPointF(t + dt); if (pt == null) { if (ed.GetDis(last) <= maxdis) { break; } else { dt = dt / Math.Sqrt(maxdis / mindis); continue; } } double dis = pt.GetDis(last); if (dis > maxdis) { dt = dt / Math.Sqrt(maxdis / mindis); b0 = true; b1 = false; continue; } else if (dis < mindis) { if (b0) { } else { dt = dt * Math.Sqrt(maxdis / mindis); b0 = false; b1 = true; continue; } } result.Add(pt); last = pt; t += dt; b0 = b1 = false; //Console.WriteLine("{0} {1}", t, pt); } if (result[result.Count - 1].GetDis(ed) > 1) { result.Add(ed); } return(result); }
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); }
/// <summary> /// 以InterpolationPrecision为时间间隔, 绘制每一个粒子的位置 /// </summary> /// <param name="deltaTime"></param> /// <returns></returns> public List <KeyValuePair <XXParticleElement, List <ASSPointF> > > RenderPoint() { Dictionary <XXParticleElement, List <ASSPointF> > parDic = new Dictionary <XXParticleElement, List <ASSPointF> >(); Queue <XXParticleElement> bornList = new Queue <XXParticleElement>(); for (double born = StartTime; born <= EndTime; born += 1.0 / Emitter.NumberPerSecond) { XXParticleElement par = Emitter.GenerateParticleElement(born); if (par == null) { continue; } par.Born = born; bornList.Enqueue(par); } List <XXParticleElement> liveList = new List <XXParticleElement>(); for (double time = StartTime; liveList.Count > 0 || bornList.Count > 0; time += InterpolationPrecision) { while (bornList.Count > 0 && bornList.Peek().Born <= time) { XXParticleElement newPar = bornList.Dequeue(); liveList.Add(newPar); parDic[newPar] = new List <ASSPointF>(); } liveList = liveList.Where(x => x.Born + x.Life > time).ToList(); List <ASSPointF> newPosition = new List <ASSPointF>(); List <ASSPointF> newSpeed = new List <ASSPointF>(); ASSPointF gravPos = null; if (GravityPosition != null) { gravPos = GravityPosition.GetGravityPosition(time); } foreach (XXParticleElement par in liveList) { double intense = 0; ASSPointF force = ForceField.GetForceField(time + par.ForceTimeOffset); if (force == null) { force = new ASSPointF { X = 0, Y = 0 } } ; ASSPointF rforce = new ASSPointF { X = Common.Sqr(par.Speed.X) * Resistance, Y = Common.Sqr(par.Speed.Y) * Resistance }; if (par.Speed.X > 0) { rforce.X = -rforce.X; } if (par.Speed.Y > 0) { rforce.Y = -rforce.Y; } force.X += rforce.X; force.Y += rforce.Y; if (Gravity != 0) { double r = Common.GetDistance(par.Position.X, par.Position.Y, gravPos.X, gravPos.Y); r = 1; //if (Math.Abs(r) > 2) { double gravr = par.Mass / Common.Sqr(r) * Gravity; //double gravr = par.Mass * r * Gravity / 100; double gravag = -Common.GetAngle(par.Position.X, par.Position.Y, gravPos.X, gravPos.Y); double gravx = gravr * Math.Cos(gravag); double gravy = gravr * Math.Sin(gravag); force.X -= gravx; force.Y -= gravy; } } if (Repulsion != 0) { foreach (XXParticleElement par2 in liveList) { if (par != par2) { double r = Common.GetDistance(par.Position.X, par.Position.Y, par2.Position.X, par2.Position.Y); if (r < 4) { if (r < 1) { r = 1; } intense += 1; } if (Math.Abs(r) < 2) { continue; } double repr = par.Mass * par2.Mass / Common.Sqr(r) * Repulsion; double repag = -Common.GetAngle(par.Position.X, par.Position.Y, par2.Position.X, par2.Position.Y); double repx = repr * Math.Cos(repag); double repy = repr * Math.Sin(repag); force.X += repx; force.Y += repy; } } } double vx1 = force.X * InterpolationPrecision / par.Mass + par.Speed.X; double vy1 = force.Y * InterpolationPrecision / par.Mass + par.Speed.Y; double sx = par.Speed.X * InterpolationPrecision; double sy = par.Speed.Y * InterpolationPrecision; newPosition.Add(new ASSPointF { X = par.Position.X + sx, Y = par.Position.Y + sy }); double vag1 = -Common.GetAngle(vx1, vy1, 0, 0); double vr1 = Common.GetDistance(vx1, vy1, 0, 0); vag1 += par.Spin * InterpolationPrecision; vx1 = vr1 * Math.Cos(vag1); vy1 = vr1 * Math.Sin(vag1); newSpeed.Add(new ASSPointF { X = vx1, Y = vy1 }); parDic[par].Add(new ASSPointF { X = par.Position.X, Y = par.Position.Y, T = time, Intense = intense }); } for (int i = 0; i < liveList.Count; i++) { liveList[i].Position = newPosition[i]; liveList[i].Speed = newSpeed[i]; } } return(parDic.ToList()); } }
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); } } }
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); }