Ejemplo n.º 1
0
        /// <summary>
        /// Creates all motion tweens.
        /// </summary>
        private void CreateTweens()
        {
            this.rTweener = new ValueTweener(this.start.R, this.finish.R, null, this.tween);
            this.rTweener.ValueChanged += (t, d) =>
            {
                this.value.R = (byte)t.Value;
            };

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

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

            this.aTweener = new ValueTweener(this.start.A, this.finish.A, null, this.tween);
            this.aTweener.ValueChanged += (t, d) =>
            {
                this.value.A = (byte)t.Value;
            };
        }
Ejemplo n.º 2
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;
            };
        }
Ejemplo n.º 3
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;
            };
        }