void CreateAnime() { anime = new KeyFrameAnime(); var pos = new PartId(Part.Hiji, Position.Left); //anime.AddFrameWithMirror(new KeyFrameAnime.Frame(3, pos, new RotationState(0, 0, 0))); //anime.AddFrameWithMirror(new KeyFrameAnime.Frame(5, pos, new RotationState(0, 0, -MathHelper.PiOver2))); //anime.AddFrame(new KeyFrameAnime.Frame(6, new PartId(Part.Root, Position.Center), new RotationState(0, -MathHelper.PiOver2, 0))); SetBodyLine(); Ojigi(1); SetBridge(5); anime.Setup(); }
public void SetAsZero(PartId part, double time, bool mirror) { var frame = new Frame(time, part, initials.Single(x => x.Part == part).State); if (mirror) { AddFrameWithMirror(frame); } else { AddFrame(frame); } }
void Ojigi(double time) { var hiji = new PartId(Part.Tekubi, Position.Left); var kata = new PartId(Part.Hiji, Position.Left); var kubi = new PartId(Part.Spine1, Position.Center); var koshi = new PartId(Part.Spine2, Position.Center); anime.SetAsZero(hiji, time, true); anime.SetAsZero(kata, time, true); anime.SetAsZero(kubi, time, false); anime.SetAsZero(koshi, time, false); var mid = time + 1; var end = time + 3; var length = 1; anime.AddFrameWithMirror(new KeyFrameAnime.Frame(mid, kata, new RotationState(0, -MathHelper.PiOver2 / 2, 0)).ShiftTime(length)); anime.AddFrameWithMirror(new KeyFrameAnime.Frame(mid, hiji, new RotationState(-MathHelper.Pi * .15f, -MathHelper.PiOver2 * 1.2f, 0)).ShiftTime(length)); anime.AddFrame(new KeyFrameAnime.Frame(mid, kubi, new RotationState(0, -MathHelper.PiOver4 * .3f, 0)).ShiftTime(length)); anime.AddFrame(new KeyFrameAnime.Frame(mid, koshi, new RotationState(0, -MathHelper.Pi * .1f, 0)).ShiftTime(length)); anime.SetAsZero(hiji, end, true); anime.SetAsZero(kata, end, true); anime.SetAsZero(kubi, end, false); anime.SetAsZero(koshi, end, false); }
public Frame(double time, PartId part, RotationState state) { Time = time; Part = part; State = state; }
void SetNextFrame(double lastTime, PartId part, Frame last) { var next = frames.First(x => x.Part == part && x.Time > lastTime); states[part] = new JointState(last, next); }