示例#1
0
        /// <summary>
        /// Creates a new animation pipeline with a delay animation as first animation.
        /// </summary>
        /// <typeparam name="TOwner">The type of the owner.</typeparam>
        /// <param name="owner">The owner.</param>
        /// <param name="seconds">The duration seconds.</param>
        /// <param name="callback">The callback.</param>
        /// <returns>The animation pipeline.</returns>
        public static IAnimationPipeline <TOwner> Delay <TOwner>(this TOwner owner, float seconds, Action callback = null)
            where TOwner : IComponent
        {
            var delayAnimation = new DelayAnimation <TOwner>(owner, seconds, callback);

            return(AnimationPipeline <TOwner> .Create(delayAnimation));
        }
示例#2
0
        /// <summary>
        /// Creates a new animation pipeline with a callback.
        /// </summary>
        /// <typeparam name="TOwner">The type of the owner.</typeparam>
        /// <param name="owner">The owner.</param>
        /// <param name="callback">The callback.</param>
        /// <returns>The animation pipeline controller.</returns>
        public static IAnimationPipeline <TOwner> Do <TOwner>(this TOwner owner, Action callback)
            where TOwner : IComponent
        {
            var animation = new DelayAnimation <TOwner>(owner, 0, callback);

            return(AnimationPipeline <TOwner> .Create(animation));
        }
示例#3
0
        /// <summary>
        /// Creates a new animation pipeline with a rectangle iteration animation as first animation.
        /// </summary>
        /// <param name="owner">The owner.</param>
        /// <param name="duration">The duration seconds.</param>]
        /// <param name="easing">The easing.</param>
        /// <param name="callback">The callback.</param>
        /// <returns>The animation pipeline.</returns>
        public static IAnimationPipeline <RectangleComponent> Iterate(this RectangleComponent owner, float duration, IEasing easing, Action <float, float> callback)
        {
            var animation = new RectangleIterateAnimation <RectangleComponent>(owner, owner.Transform.BoundingBox, owner.Filled, duration, callback)
            {
                Easing = easing
            };

            return(AnimationPipeline <RectangleComponent> .Create(animation));
        }
示例#4
0
        /// <summary>
        /// Creates a new animation pipeline with a rectangle iteration animation as first animation.
        /// </summary>
        /// <param name="owner">The owner.</param>
        /// <param name="filled">If rectangle should be filled.</param>
        /// <param name="duration">The duration seconds.</param>
        /// <param name="easing">The easing.</param>
        /// <param name="callback">The callback.</param>
        /// <returns>The animation pipeline.</returns>
        public static IAnimationPipeline <ITransformable> Iterate(this ITransformable owner, bool filled, float duration, IEasing easing, Action <float, float> callback)
        {
            var animation = new RectangleIterateAnimation <ITransformable>(owner, owner.Transform.BoundingBox, filled, duration, callback)
            {
                Easing = easing
            };

            return(AnimationPipeline <ITransformable> .Create(animation));
        }
示例#5
0
        /// <summary>
        /// Animates the floot value between the values defined in to and from arguments.
        /// </summary>
        /// <returns>The animation pipeline.</returns>
        /// <param name="component">Component.</param>
        /// <param name="from">From.</param>
        /// <param name="to">To.</param>
        /// <param name="duration">Duration.</param>
        /// <param name="easing">Easing.</param>
        /// <param name="callback">Callback.</param>
        public static IAnimationPipeline <TOwner> To <TOwner>(this TOwner component, float from, float to, float duration, IEasing easing, Action <float> callback)
            where TOwner : IComponent
        {
            var animation = new FloatAnimation <TOwner>(component, from, to, duration, callback);

            animation.Easing = easing;

            return(AnimationPipeline <TOwner> .Create(animation));
        }
示例#6
0
        public static AnimationPipeline <TOwner> Create(IAnimation <TOwner> firstAnimation)
        {
            var pipeline = new AnimationPipeline <TOwner>();

            pipeline.Add(firstAnimation);
            pipeline.Owner            = firstAnimation.Owner;
            pipeline.currentAnimation = firstAnimation;

            return(pipeline);
        }
示例#7
0
        /// <summary>
        /// Creates a new animation pipeline with a rectangle iteration animation as first animation.
        /// </summary>
        /// <param name="owner">The owner.</param>
        /// <param name="rectanle">The rectangle.</param>
        /// <param name="filled">If rectangle should be filled.</param>
        /// <param name="duration">The duration seconds.</param>]
        /// <param name="easing">The easing.</param>
        /// <param name="callback">The callback.</param>
        /// <returns>The animation pipeline controller.</returns>
        public static IAnimationPipeline <TOwner> Iterate <TOwner>(this TOwner owner, Rectangle rectanle, bool filled, float duration, IEasing easing, Action <float, float> callback)
            where TOwner : IComponent
        {
            var animation = new RectangleIterateAnimation <TOwner>(owner, rectanle, filled, duration, callback)
            {
                Easing = easing
            };

            return(AnimationPipeline <TOwner> .Create(animation));
        }