예제 #1
0
        /// <summary>
        /// Blends progressively a new animation.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="desiredWeight">The desired weight.</param>
        /// <param name="fadeTimeSpan">The fade time span.</param>
        /// <exception cref="ArgumentException">name</exception>
        public void Blend(string name, float desiredWeight, TimeSpan fadeTimeSpan)
        {
            if (!Animations.ContainsKey(name))
            {
                throw new ArgumentException("name");
            }

            var playingAnimation = new PlayingAnimation(this, name)
            {
                CurrentTime = TimeSpan.Zero, Weight = 0.0f
            };

            PlayingAnimations.Add(playingAnimation);

            if (fadeTimeSpan > TimeSpan.Zero)
            {
                playingAnimation.WeightTarget  = desiredWeight;
                playingAnimation.RemainingTime = fadeTimeSpan;
            }
            else
            {
                playingAnimation.Weight = desiredWeight;
            }
        }
예제 #2
0
 private AnimationOperation CreatePushOperation(PlayingAnimation playingAnimation)
 {
     return(AnimationOperation.NewPush(playingAnimation.Evaluator, playingAnimation.CurrentTime));
 }