Assembly: Ab3d.Reader3ds (in Ab3d.Reader3ds)
Version: 4.2.0.0 (4.2.0.0)
Syntax
| C# |
|---|
public class Animator3ds |
| Visual Basic (Declaration) |
|---|
Public Class Animator3ds |
| Visual C++ |
|---|
public ref class Animator3ds |
Remarks
Animator3ds simplifies playing animations from 3ds files by simply setting some animation properties (for example AnimationDuration, AutoRepeat, AutoReverse, etc) and simply calling DoAnimate()()() method each time the new frame should be rendered. In DoAnimate method the frame that is renders is calculated from the time difference between previous and this DoAnimate calls. This way the animation is played according to the set AnimationDuration or ModelFramesPerSecond regardless of the computer on which it is run. That means that on slower computers there would be less frames per seconds rendered, and on faster computer more - but the animation would last the same amount of time.
Because Animator3ds relays on Reader3ds (it is calling its GetFrame(Int32, Viewport3D) method) it must be constructed with an instance of Reader3ds. This can be simplified with using the Animator property on Reader3ds class.
Examples
void StartAnimation() { CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering); Ab3d.Reader3ds.Instance.Animator.AnimationDuration = new TimeSpan(0, 0, 10); // 10 seconds Ab3d.Reader3ds.Instance.ReadFile("SampleAnimation.3ds", myViewport); } void EndAnimation() { CompositionTarget.Rendering -= new EventHandler(CompositionTarget_Rendering); Ab3d.Reader3ds.Instance.Animator.Stop(); } void CompositionTarget_Rendering(object sender, EventArgs e) { Ab3d.Reader3ds.Instance.Animator.DoAnimate(); }