public override void Update() { this._Sides[0].Y = -75 - ((this._Middle.Rotation / Meth.Tau * 10 * 30 + 5) % 30 - 5); this._Sides[1].Y = -75 + (this._Middle.Rotation / Meth.Tau * 10 * 30 + 25) % 30 - 25; if (this.Runtime == 330) { this._Done = true; this._Middle.Done = true; } if (this._Done && this._DoneProgress0 < 100) { this._DoneProgress0++; this._Cutoffs[0].Position.Y += 1; this._Cutoffs[1].Position.Y -= 0.5; this.Position = this.Parent.Resolution / 2 - (Point)(new Vector(220, 70) * Meth.Smooth(this._DoneProgress0 / 100.0) * this.Scale); } if (this._Done && this._DoneProgress0 >= 50 && this._DoneProgress1 < 80) { this._DoneProgress1++; for (int i = 0; i < 6; i++) { this._Letters[i].Color = Color.White * Meth.Limit(0, Meth.Smooth(this._DoneProgress1 / 80.0) * 6 - i, 1); } } this.Parent.Title = this.Parent.Fps.ToString(); }
public Rack(bool _fixedres) { double[] ls = new double[] { 15, 15, 30 }; double[] ds = new double[] { 0.2, 0.1 }; VertexArray lines = new VertexArray(VertexArrayType.LinesStrip) { Color = Color.White * 0.25, /*Position = _fixedres ? 0.5 : 0, */ LockToGrid = _fixedres }; lines.Add(new Vector(0, ls[2] * 7), new Vector(0, 0), new Vector(0, 0)); for (int i = 0; i < 7; i++) { Bunch <Vector> vs = new Bunch <Vector>(); vs.Add(new Vector(0, i * ls[2])); //lines0.Add(new Vector(0, i * ls[2]), new Vector(0, (i + 1) * ls[2])); Action <Vector> add = v => { vs.Add(v); lines.Add(v); }; add(new Vector(ls[0], i * ls[2])); //vs.Add(new Vector(ls[0] + ls[1], (i + 0.5) * ls[2])); for (int n = 0; n <= 3; n++) { add(new Vector(ls[0] + Meth.Smooth(n / 3.0) * ls[1], i * ls[2] + ls[2] * ds[0] + ls[2] * ds[1] * (n / 3.0))); } for (int n = 0; n <= 3; n++) { add(new Vector(ls[0] + Meth.Smooth((3 - n) / 3.0) * ls[1], i * ls[2] + ls[2] * (1 - ds[0] - ds[1]) + ls[2] * ds[1] * (n / 3.0))); } add(new Vector(ls[0], (i + 1) * ls[2])); vs.Add(new Vector(0, (i + 1) * ls[2])); this.Graphics.Add(new VertexArray(VertexArrayType.TrianglesFan) { Vertices = new Vertex(new Vector(0, (i + 0.5) * ls[2]), Color.White) + vs.Select(item => (Vertex)item), Color = Color.White, LockToGrid = _fixedres }); } lines.Add(new Vector(0, ls[2] * 7)); this.Graphics.Add(lines); }
public override void Update() { if (this.ProgressIndefinitely) { this.Progress += (1 - this.Progress) / 200; } if (this.Started) { if (!this.Finished) { this.RealProgress += (this.TargetProgress - this.RealProgress) * 0.1; //if (this.TargetProgress == 1) //{ // this.Finished = true; // this.Kill(); //} if ((this.Runtime - 20) % 120 < 60) { this.LineProgress = 0; } else { this.LineProgress = Meth.Smooth(((this.Runtime - 20) % 120 - 60) / 60.0); } } else { this.RealProgress *= 0.9; this.LineProgress -= 1 / 10.0; this.Graphics.Remove(this.OuterRing); Bunch <Vector> vs = new Bunch <Vector>(); for (int i = 0; i <= 20; i++) { vs.Add(Vector.FromAngle(i / 20.0 * Meth.Tau, 8 * Meth.Root(this.RealProgress))); } this.OuterRing = Line.DrawMultiple(vs, Color.Black, 1); this.Graphics.Add(this.OuterRing); this.Text.Scale = new Vector(Meth.Square(this.RealProgress), this.RealProgress); this.Text.Position.X = this.RealProgress * 10; if (this.RealProgress < 0.001) { this.Kill(); } } } else { this.LineProgress += (1 - this.LineProgress) * 0.1; this.RealProgress += (this.TargetProgress - this.RealProgress) * 0.1; this.RealProgress = Meth.Min(this.LineProgress, this.RealProgress); this.Graphics.Remove(this.OuterRing); Bunch <Vector> vs = new Bunch <Vector>(); for (int i = 0; i <= 20; i++) { vs.Add(Vector.FromAngle(i / 20.0 * Meth.Tau, 8 * this.LineProgress)); } this.OuterRing = Line.DrawMultiple(vs, Color.Black, 1); this.Graphics.Add(this.OuterRing); this.Text.Scale = new Vector(Meth.Square(this.LineProgress), this.LineProgress); this.Text.Position.X = this.LineProgress * 10; if (this.LineProgress > 0.99) { this.LineProgress = 1; this.Started = true; } } this.Graphics.Remove(this.InnerRing); Bunch <Vector> ps = new Bunch <Vector>(); for (int i = 0; i <= 20; i++) { ps.Add(Vector.FromAngle(i / 20.0 * Meth.Tau, 8 * this.RealProgress)); } this.InnerRing = Line.DrawMultiple(ps, Color.Black, 1); this.Graphics.Add(this.InnerRing); this.Lines.Vertices.Clear(); this.Lines.Add(0); this.Lines.Add(Vector.FromAngle(this.LineProgress * Meth.Tau, 8 * this.RealProgress)); this.Lines.Add(Vector.FromAngle(this.LineProgress * -Meth.Tau - Meth.Tau / 2, 8 * this.RealProgress)); this.Lines.Add(Vector.FromAngle(this.LineProgress * -Meth.Tau - Meth.Tau / 2, this.Finished ? 8 * Meth.Root(this.RealProgress) : 8)); }
public Gear(bool _fixedres) { double[] ls = new double[] { 20, 20, 20, 15 }; double[] fs = new double[] { 0.1, 0.15 }; VertexArray lines0 = new VertexArray(VertexArrayType.LinesStrip) { Color = Color.White * 0.25, LockToGrid = _fixedres }; VertexArray lines1 = new VertexArray(VertexArrayType.LinesStrip) { Color = Color.White * 0.25, LockToGrid = _fixedres }; for (int i = 0; i < 10; i++) { Bunch <Vector> vs = new Bunch <Vector>(); double a0 = Meth.Tau / 10 * i; double a1 = Meth.Tau / 10 * (i + 1); //vs.Add(Vector.FromAngle(a1, ls[0]), Vector.FromAngle(a0, ls[0])); //double ag = (a0 + a1) / 2; //Vector vg = Vector.FromAngle(ag, ls[2]); //Vector va = Vector.FromAngle(ag + Meth.Tau / 4); Action <Vector> add = v => { vs.Add(v); lines1.Add(v); }; for (int n = 0; n <= 2; n++) { vs.Add(Vector.FromAngle(a1 - (a1 - a0) / 2 * n, ls[0])); } for (int n = 2; n >= 0; n--) { lines0.Add(Vector.FromAngle(a1 - (a1 - a0) / 2 * n, ls[0])); } Vector va0 = Vector.FromAngle(a0, ls[0] + ls[1]); Vector va1 = Vector.FromAngle(a1, ls[0] + ls[1]); Vector dif = Vector.FromAngle(a1, ls[0] + ls[1]) - Vector.FromAngle(a0, ls[0] + ls[1]); for (int n = 0; n <= 2; n++) { add(Vector.FromAngle(a0 + ((va0 + dif * fs[0]).Angle - a0) / 2 * n, ls[0] + ls[1])); } for (int n = 0; n <= 3; n++) { add(va0 + dif * fs[0] + dif * (n / 3.0) * fs[1] + Vector.FromAngle(dif.Angle - Meth.Tau / 4, Meth.Smooth(n / 3.0) * ls[3])); } for (int n = 0; n <= 3; n++) { add(va0 + dif * (1 - fs[0] - fs[1]) + dif * (n / 3.0) * fs[1] + Vector.FromAngle(dif.Angle - Meth.Tau / 4, Meth.Smooth((3 - n) / 3.0) * ls[3])); } //vs.Add(Vector.FromAngle(a1, ls[0] + ls[1])); for (int n = 0; n <= 2; n++) { add(Vector.FromAngle((va0 + dif * (1 - fs[0])).Angle + (a1 - (va0 + dif * (1 - fs[0])).Angle) / 2 * n, ls[0] + ls[1])); } //vs.Add(va1); //for (int s = -1; s <= -1; s += 2) //{ // Vector p = Vector.FromAngle((s == 1) ? a1 : a0, ls[0] + ls[1]); // for (int n = 0; n <= 10; n++) // vs.Add(p + (vg * Meth.Smooth(n / 10.0) + va * ls[3] * (n / 10.0)) * s); //} this.Graphics.Add(new VertexArray(VertexArrayType.Polygon) { Vertices = vs.Select(item => (Vertex)item), Color = Color.White, LockToGrid = _fixedres }); } this.Graphics.Add(lines0, lines1); }
public override void Update() { base.Update(); this._Sides[0].Y = -75 - Meth.Up((this._Middle.Rotation / Meth.Tau * 10 * 30 + 5) % 30 - 5); this._Sides[1].Y = -75 + Meth.Up((this._Middle.Rotation / Meth.Tau * 10 * 30 + 25) % 30 - 25); DateTime start = DateTime.Now; while ((DateTime.Now - start).TotalMilliseconds < 3 && this._Loadables.Count > 0) { if (this._Loadables[0].FinishedLoading) { this._Loadables.RemoveAt(0); if (this._Loadables.Count == 0) { this._DoneLoading = true; this.Skippable = true; } } else { this._Loadables[0].LoadStep(); } } if (this.Runtime % 110 == 0 && this._DoneLoading) { this._Done = true; this._Middle.Done = true; this.Skippable = true; } if (this._Done && this._DoneProgress0 < 100) { this._DoneProgress0++; this._Cutoffs[0].Position.Y += 1; this._Cutoffs[1].Position.Y -= 0.5; this.Position = this.Parent.Resolution / 2 - (Point)(new Vector(220, 70) * Meth.Smooth(this._DoneProgress0 / 100.0) * this.Scale); } if (this._Done && this._DoneProgress0 >= 50 && this._DoneProgress1 < 80) { this._DoneProgress1++; for (int i = 0; i < 6; i++) { this._Letters[i].TextColor = Color.White * Meth.Limit(0, Meth.Smooth(this._DoneProgress1 / 80.0) * 6 - i, 1); } } if (this._DoneProgress1 >= 80 && this._DoneProgress1 < 120) { this._DoneProgress1++; } if (this._DoneProgress1 == 120) { this._DoneProgress2++; this.Color = Color.White * Meth.Smooth(1 - this._DoneProgress2 * 3 / 255.0); if (this._DoneProgress2 == 85) { this.Kill(); } } }