Ejemplo n.º 1
0
        public void CompleteTestBackward()
        {
            bool completed = false;
            TweenAnimation <float> tween = new TweenAnimation <float>()
            {
                From     = -0.239572048f,
                To       = 1.2223f,
                Duration = TimeSpan.FromSeconds(2.34123f),
            };

            tween.Completed += (o, e) =>
            {
                completed = true;
            };
            tween.StartupDirection = AnimationDirection.Backward;
            ((IAnimation)tween).OnStarted();
            tween.Update(0.34234f);
            tween.Update(1.284957f);
            tween.Update(0.0001479f);
            tween.Update(2.38562939f);

            Assert.IsTrue(completed);
            Assert.AreEqual <TimeSpan>(TimeSpan.Zero, tween.Position);
            Assert.AreEqual <TimeSpan>(tween.Duration, tween.ElapsedTime);
            Assert.AreEqual <float>(tween.From.Value, tween.Value);
        }
Ejemplo n.º 2
0
        public void CompleteTestWithZeroDuration()
        {
            bool completed = false;
            TweenAnimation <float> tween = new TweenAnimation <float>()
            {
                From     = -1,
                To       = 1,
                Duration = TimeSpan.Zero,
            };

            tween.Completed += (o, e) =>
            {
                completed = true;
            };
            ((IAnimation)tween).OnStarted();
            tween.Update(0.34234f);

            Assert.IsTrue(completed);
            Assert.AreEqual <TimeSpan>(tween.Duration, tween.Position);
            Assert.AreEqual <TimeSpan>(tween.Duration, tween.ElapsedTime);
            Assert.AreEqual <float>(tween.From.Value, tween.Value);
        }