A 'track' in an animation sequence, ie a sequence of keyframes which affect a certain type of object that can be animated.
This class is intended as a base for more complete classes which will actually animate specific types of object, e.g. a bone in a skeleton to affect skeletal animation. An animation will likely include multiple tracks each of which can be made up of many KeyFrame instances. Note that the use of tracks allows each animable object to have it's own number of keyframes, i.e. you do not have to have the maximum number of keyframes for all animable objects just to cope with the most animated one.

Since the most common animable object is a Node, there are options in this class for associating the track with a Node which will receive keyframe updates automatically when the 'apply' method is called.

예제 #1
0
파일: KeyFrame.cs 프로젝트: axiom3d/axiom
 /// <summary>
 ///		Creates a new keyframe with the specified time.
 ///		Should really be created by <see cref="AnimationTrack.CreateKeyFrame"/> instead.
 /// </summary>
 /// <param name="parent">Animation track that this keyframe belongs to.</param>
 /// <param name="time">Time at which this keyframe begins.</param>
 public TransformKeyFrame(AnimationTrack parent, float time)
     : base(parent, time)
 {
     this.translate = new Vector3();
     this.scale     = Vector3.UnitScale;
     this.rotation  = Quaternion.Identity;
 }
예제 #2
0
 /// <summary>
 ///		Creates a new keyframe with the specified time.
 ///		Should really be created by <see cref="AnimationTrack.CreateKeyFrame"/> instead.
 /// </summary>
 /// <param name="parent">Animation track that this keyframe belongs to.</param>
 /// <param name="time">Time at which this keyframe begins.</param>
 public TransformKeyFrame(AnimationTrack parent, float time) : base(parent, time)
 {
     translate.x = 0f;
     translate.y = 0f;
     translate.z = 0f;
     scale.x     = 1f;
     scale.y     = 1f;
     scale.z     = 1f;
     rotation.w  = 1f;
     rotation.x  = 1f;
     rotation.y  = 1f;
     rotation.z  = 1f;
 }
예제 #3
0
		/// <summary>
		///		Creates a new keyframe with the specified time.  
		///		Should really be created by <see cref="AnimationTrack.CreateKeyFrame"/> instead.
		/// </summary>
		/// <param name="parent">Animation track that this keyframe belongs to.</param>
		/// <param name="time">Time at which this keyframe begins.</param>
		public KeyFrame( AnimationTrack parent, float time )
		{
			this.parentTrack = parent;
			this.time = time;
		}
예제 #4
0
		/// <summary>
		///		Creates a new keyframe with the specified time.  
		///		Should really be created by <see cref="AnimationTrack.CreateKeyFrame"/> instead.
		/// </summary>
		/// <param name="parent">Animation track that this keyframe belongs to.</param>
		/// <param name="time">Time at which this keyframe begins.</param>
		public VertexPoseKeyFrame( AnimationTrack parent, float time )
			: base( parent, time )
		{
		}
예제 #5
0
		/// <summary>
		///		Creates a new keyframe with the specified time.  
		///		Should really be created by <see cref="AnimationTrack.CreateKeyFrame"/> instead.
		/// </summary>
		/// <param name="parent">Animation track that this keyframe belongs to.</param>
		/// <param name="time">Time at which this keyframe begins.</param>
		public TransformKeyFrame( AnimationTrack parent, float time )
			: base( parent, time )
		{
			translate = new Vector3();
			scale = Vector3.UnitScale;
			rotation = Quaternion.Identity;
		}
예제 #6
0
		/// <summary>
		///		Creates a new keyframe with the specified time.  
		///		Should really be created by <see cref="AnimationTrack.CreateKeyFrame"/> instead.
		/// </summary>
		/// <param name="parent">Animation track that this keyframe belongs to.</param>
		/// <param name="time">Time at which this keyframe begins.</param>
		public NumericKeyFrame( AnimationTrack parent, float time )
			: base( parent, time )
		{
		}
예제 #7
0
파일: KeyFrame.cs 프로젝트: axiom3d/axiom
 /// <summary>
 ///		Creates a new keyframe with the specified time.
 ///		Should really be created by <see cref="AnimationTrack.CreateKeyFrame"/> instead.
 /// </summary>
 /// <param name="parent">Animation track that this keyframe belongs to.</param>
 /// <param name="time">Time at which this keyframe begins.</param>
 public KeyFrame(AnimationTrack parent, float time)
 {
     this.parentTrack = parent;
     this.time        = time;
 }
예제 #8
0
파일: KeyFrame.cs 프로젝트: axiom3d/axiom
 /// <summary>
 ///		Creates a new keyframe with the specified time.
 ///		Should really be created by <see cref="AnimationTrack.CreateKeyFrame"/> instead.
 /// </summary>
 /// <param name="parent">Animation track that this keyframe belongs to.</param>
 /// <param name="time">Time at which this keyframe begins.</param>
 public VertexPoseKeyFrame(AnimationTrack parent, float time)
     : base(parent, time)
 {
 }
예제 #9
0
파일: KeyFrame.cs 프로젝트: axiom3d/axiom
 /// <summary>
 ///		Creates a new keyframe with the specified time.
 ///		Should really be created by <see cref="AnimationTrack.CreateKeyFrame"/> instead.
 /// </summary>
 /// <param name="parent">Animation track that this keyframe belongs to.</param>
 /// <param name="time">Time at which this keyframe begins.</param>
 public NumericKeyFrame(AnimationTrack parent, float time)
     : base(parent, time)
 {
 }
예제 #10
0
 /// <summary>
 ///		Creates a new keyframe with the specified time.  
 ///		Should really be created by <see cref="AnimationTrack.CreateKeyFrame"/> instead.
 /// </summary>
 /// <param name="parent">Animation track that this keyframe belongs to.</param>
 /// <param name="time">Time at which this keyframe begins.</param>
 public TransformKeyFrame(AnimationTrack parent, float time)
     : base(parent, time)
 {
     translate.x = 0f;
     translate.y = 0f;
     translate.z = 0f;
     scale.x = 1f;
     scale.y = 1f;
     scale.z = 1f;
     rotation.w = 1f;
     rotation.x = 1f;
     rotation.y = 1f;
     rotation.z = 1f;
 }
 protected void ReadKeyFrames(XmlNode node, AnimationTrack track)
 {
     foreach (XmlNode childNode in node.ChildNodes) {
         switch (childNode.Name) {
             case "keyframe":
                 ReadKeyFrame(childNode, track);
                 break;
             default:
                 DebugMessage(childNode);
                 break;
         }
     }
 }
        protected void ReadKeyFrame(XmlNode node, AnimationTrack track)
        {
            float time = float.Parse(node.Attributes["time"].Value);
            // create a new keyframe with the specified length
            TransformKeyFrame keyFrame = (TransformKeyFrame)track.CreateKeyFrame(time);

            foreach (XmlNode childNode in node.ChildNodes) {
                switch (childNode.Name) {
                    case "translate":
                        keyFrame.Translate = ReadVector3(childNode);
                        break;
                    case "rotate":
                        ReadRotate(childNode, keyFrame);
                        break;
                    default:
                        DebugMessage(childNode);
                        break;
                }
            }
        }
 protected void AddKey(AnimationTrack track, float time, Vector3 translate)
 {
     TransformKeyFrame key = (TransformKeyFrame)track.CreateKeyFrame(time);
     key.Translate = translate;
 }