/// <summary>
        /// Creates a new animation sampler from a list of keyframes
        /// </summary>
        /// <param name="keyframes">List of samples</param>
        /// <param name="interpolation">Interpolation method to use</param>
        public JointAnimationSampler(JointAnimationKeyFrame[] keyframes,
                                     AnimationInterpolation interpolation)
        {
            _keyframes     = keyframes;
            _interpolation = interpolation;

            if (_interpolation != AnimationInterpolation.Linear)
            {
                // Right now only linear interpolation is supported
                _interpolation = AnimationInterpolation.Linear;
            }

            if (keyframes == null || keyframes.Length == 0)
            {
                throw new ApplicationException("Sampler needs keyframes");
            }

            StartTime = keyframes[0].Time;
            EndTime   = keyframes[keyframes.Length - 1].Time;

            PostBehaviour = AnimationBehaviour.Cycle;
        }
示例#2
0
        protected virtual ITimeInterpolator ResolveDroidInterpolatorFrom(AnimationInterpolation interpolation)
        {
            return(base.ExecuteFunction <ITimeInterpolator>("ResolveDroidInterpolatorFrom", delegate()
            {
                switch (interpolation)
                {
                case AnimationInterpolation.Accelerate:
                    return new AccelerateInterpolator();

                case AnimationInterpolation.EaseInEaseOut:
                    return new AccelerateDecelerateInterpolator();

                case AnimationInterpolation.EaseIn:
                    return new AccelerateInterpolator();

                case AnimationInterpolation.EaseOut:
                    return new DecelerateInterpolator();

                default:
                case AnimationInterpolation.Linear:
                    return new LinearInterpolator();
                }
            }));
        }
示例#3
0
 public virtual DroidAnimator SetDefaultInterpolation(AnimationInterpolation interpolation)
 {
     this.DefaultInterpolation = interpolation;
     return(this);
 }
        /// <summary>
        /// Creates a new animation sampler from a list of keyframes
        /// </summary>
        /// <param name="keyframes">List of samples</param>
        /// <param name="interpolation">Interpolation method to use</param>
        public JointAnimationSampler(JointAnimationKeyFrame[] keyframes, 
            AnimationInterpolation interpolation)
        {
            _keyframes = keyframes;
            _interpolation = interpolation;

            if (_interpolation != AnimationInterpolation.Linear)
            {
                // Right now only linear interpolation is supported
                _interpolation = AnimationInterpolation.Linear;
            }

            if (keyframes == null || keyframes.Length == 0)
            {
                throw new ApplicationException("Sampler needs keyframes");
            }

            StartTime = keyframes[0].Time;
            EndTime = keyframes[keyframes.Length - 1].Time;

            PostBehaviour = AnimationBehaviour.Cycle;
        }