public AnimationFrameBase FrameForTime3D(int time, AnimationFrameBase startKeyFrameBase, AnimationFrameBase endKeyFrameBase) { var startKeyFrame = startKeyFrameBase as AnimationFrame; var endKeyFrame = endKeyFrameBase as AnimationFrame; AnimationFrame animationFrame = new AnimationFrame(); animationFrame.Transform = new Transform3D(); animationFrame.Transform.M34 = startKeyFrame.Transform.M34; //if (startKeyFrame.Transform.Translate != null) { Transform3DTranslate translate = new Transform3DTranslate(); translate.Tx = Animation.TweenValueForStartTime(startKeyFrame.Time, endKeyFrame.Time, startKeyFrame.Transform.Translate.Tx, endKeyFrame.Transform.Translate.Tx, time); translate.Ty = Animation.TweenValueForStartTime(startKeyFrame.Time, endKeyFrame.Time, startKeyFrame.Transform.Translate.Ty, endKeyFrame.Transform.Translate.Ty, time); translate.Tz = Animation.TweenValueForStartTime(startKeyFrame.Time, endKeyFrame.Time, startKeyFrame.Transform.Translate.Tz, endKeyFrame.Transform.Translate.Tz, time); animationFrame.Transform.Translate = translate; //} //if (startKeyFrame.Transform.Rotate != null) { Transform3DRotate rotate = new Transform3DRotate(); rotate.Angle = Animation.TweenValueForStartTime(startKeyFrame.Time, endKeyFrame.Time, startKeyFrame.Transform.Rotate.Angle, endKeyFrame.Transform.Rotate.Angle, time); rotate.X = Animation.TweenValueForStartTime(startKeyFrame.Time, endKeyFrame.Time, startKeyFrame.Transform.Rotate.X, endKeyFrame.Transform.Rotate.X, time); rotate.Y = Animation.TweenValueForStartTime(startKeyFrame.Time, endKeyFrame.Time, startKeyFrame.Transform.Rotate.Y, endKeyFrame.Transform.Rotate.Y, time); rotate.Z = Animation.TweenValueForStartTime(startKeyFrame.Time, endKeyFrame.Time, startKeyFrame.Transform.Rotate.Z, endKeyFrame.Transform.Rotate.Z, time); animationFrame.Transform.Rotate = rotate; //} //if (startKeyFrame.Transform.Scale != null) { Transform3DScale scale = new Transform3DScale(); scale.Sx = Animation.TweenValueForStartTime(startKeyFrame.Time, endKeyFrame.Time, startKeyFrame.Transform.Scale.Sx, endKeyFrame.Transform.Scale.Sx, time); scale.Sy = Animation.TweenValueForStartTime(startKeyFrame.Time, endKeyFrame.Time, startKeyFrame.Transform.Scale.Sy, endKeyFrame.Transform.Scale.Sy, time); scale.Sz = Animation.TweenValueForStartTime(startKeyFrame.Time, endKeyFrame.Time, startKeyFrame.Transform.Scale.Sz, endKeyFrame.Transform.Scale.Sz, time); animationFrame.Transform.Scale = scale; //} return(animationFrame); }
public Transform3D() { Scale = new Transform3DScale() { Sx = 1.0f, Sy = 1.0f, Sz = 1.0f }; Rotate = new Transform3DRotate() { Angle = 0.0f, X = 1.0f, Y = 1.0f, Z = -1.0f }; Translate = new Transform3DTranslate() { Tx = 0.0f, Ty = 0.0f, Tz = 50.0f }; M34 = 0.3f; }