Example #1
0
 /// <summary>
 /// Creates a new <see cref="ValueTweener"/> class instance.
 /// </summary>
 /// <param name="start">Initial value</param>
 /// <param name="finish">Final value</param>
 /// <param name="tween">Easing function</param>
 /// <param name="data">User data</param>
 public ValueTweener(float start, float finish, object data, MotionTweens.TweenFunction tween)
 {
     this.start  = start;
     this.finish = finish;
     this.tween  = tween ?? MotionTweens.Linear;
     this.data   = data;
 }
Example #2
0
 /// <summary>
 /// Creates a new <see cref="ValueTweener"/> class instance.
 /// </summary>
 /// <param name="start">Initial value</param>
 /// <param name="finish">Final value</param>
 /// <param name="data">User data</param>
 public ValueTweener(float start, float finish, object data)
 {
     this.start  = start;
     this.finish = finish;
     this.tween  = MotionTweens.Linear;
     this.data   = data;
 }
Example #3
0
 /// <summary>
 /// Creates a forward movement state.
 /// </summary>
 /// <param name="duration">State duration time in seconds.</param>
 /// <param name="tween">Tween function for this state.</param>
 /// <returns>Current tweener instance for fluent configuration.</returns>
 public ColorTweener Backward(float duration, MotionTweens.TweenFunction tween)
 {
     this.rTweener.Backward(duration, tween);
     this.gTweener.Backward(duration, tween);
     this.bTweener.Backward(duration, tween);
     this.aTweener.Backward(duration, tween);
     return(this);
 }
Example #4
0
        /// <summary>
        /// Creates a new <see cref="ColorTweener"/> class instance.
        /// </summary>
        /// <param name="start">Initial value</param>
        /// <param name="finish">Final value</param>
        public ColorTweener(Microsoft.Xna.Framework.Color start, Microsoft.Xna.Framework.Color finish)
        {
            this.start  = start;
            this.finish = finish;
            this.tween  = MotionTweens.Linear;

            this.CreateTweens();
        }
Example #5
0
        /// <summary>
        /// Creates a new <see cref="ColorTweener"/> class instance.
        /// </summary>
        /// <param name="start">Initial value</param>
        /// <param name="finish">Final value</param>
        /// <param name="tween">Easing function</param>
        /// <param name="data">User data</param>
        public ColorTweener(Microsoft.Xna.Framework.Color start, Microsoft.Xna.Framework.Color finish, object data, MotionTweens.TweenFunction tween)
        {
            this.start  = start;
            this.finish = finish;
            this.tween  = tween ?? MotionTweens.Linear;
            this.data   = data;

            this.CreateTweens();
        }
Example #6
0
 /// <summary>
 /// Creates a forward movement state.
 /// </summary>
 /// <param name="duration">State duration time in seconds.</param>
 /// <param name="tween">Tween function for this state.</param>
 /// <returns>Current tweener instance for fluent configuration.</returns>
 public ValueTweener Backward(float duration, MotionTweens.TweenFunction tween)
 {
     return(this.RegisterState(new MoveState()
     {
         Start = this.finish,
         Finish = this.start,
         Duration = duration,
         Tween = tween
     }));
 }
Example #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ValueTweener"/> class.
        /// </summary>
        /// <param name="start">Initial value</param>
        /// <param name="finish">Final value</param>
        public VectorTweener(Vector2 start, Vector2 finish)
        {
            this.tween = MotionTweens.Linear;

            this.xTweener = new ValueTweener(start.X, finish.X, null, this.tween);
            this.xTweener.ValueChanged += (t, d) =>
            {
                this.value.X = t.Value;
            };

            this.yTweener = new ValueTweener(start.Y, finish.Y, null, this.tween);
            this.yTweener.ValueChanged += (t, d) =>
            {
                this.value.Y = t.Value;
            };
        }
Example #8
0
        /// <summary>
        /// Creates a new <see cref="ValueTweener"/> class instance.
        /// </summary>
        /// <param name="start">Initial value</param>
        /// <param name="finish">Final value</param>
        /// <param name="tween">Easing function</param>
        /// <param name="data">User data</param>
        public VectorTweener(Vector2 start, Vector2 finish, object data, MotionTweens.TweenFunction tween)
        {
            this.tween = tween ?? MotionTweens.Linear;
            this.data  = data;

            this.xTweener = new ValueTweener(start.X, finish.X, null, tween);
            this.xTweener.ValueChanged += (t, d) =>
            {
                this.value.X = t.Value;
            };

            this.yTweener = new ValueTweener(start.Y, finish.Y, null, tween);
            this.yTweener.ValueChanged += (t, d) =>
            {
                this.value.Y = t.Value;
            };
        }
Example #9
0
 /// <summary>
 /// Creates a new <see cref="ValueTweener"/> class instance.
 /// </summary>
 /// <param name="start">Initial value</param>
 /// <param name="finish">Final value</param>
 public ValueTweener(float start, float finish)
 {
     this.start  = start;
     this.finish = finish;
     this.tween  = MotionTweens.Linear;
 }
Example #10
0
 /// <summary>
 /// Creates a forward movement state.
 /// </summary>
 /// <param name="duration">State duration time in seconds.</param>
 /// <param name="tweenx">Tween function for this state (x axis).</param>
 /// <param name="tweeny">Tween function for this state (y axis).</param>
 /// <returns>Current tweener instance for fluent configuration.</returns>
 public VectorTweener Backward(float duration, MotionTweens.TweenFunction tweenx, MotionTweens.TweenFunction tweeny)
 {
     this.xTweener.Backward(duration, tweenx);
     this.yTweener.Backward(duration, tweeny);
     return(this);
 }
Example #11
0
 /// <summary>
 /// Creates a forward movement state.
 /// </summary>
 /// <param name="duration">State duration time in seconds.</param>
 /// <param name="tween">Tween function for this state.</param>
 /// <returns>Current tweener instance for fluent configuration.</returns>
 public VectorTweener Forward(float duration, MotionTweens.TweenFunction tween)
 {
     this.xTweener.Forward(duration, tween);
     this.yTweener.Forward(duration, tween);
     return(this);
 }