Esempio n. 1
0
        [Test] public void Basics()
        {
            AnimationTrack <float> track;

            track = new AnimationTrack <float>(0.0f, 1.0f);
            for (int i = 0; i <= 100; i++)
            {
                float time = (float)i / 100.0f;
                Assert.AreEqual(time, track[time], 0.001f);
            }
            track.ScaleToDuration(10.0f);
            for (int i = 0; i <= 100; i++)
            {
                float time = (float)i / 100.0f;
                Assert.AreEqual(time, track[10.0f * time], 0.001f);
            }

            track = new AnimationTrack <float>
            {
                { 0.5f, 10.0f },
                { 1.0f, 20.0f },
                { 1.5f, 30.0f }
            };
            Assert.AreEqual(10.0f, track[0.0f], 0.001f);
            Assert.AreEqual(30.0f, track[2.0f], 0.001f);

            track.IsLooping = true;
            Assert.AreEqual(10.0f, track[0.0f], 0.001f);
            Assert.AreEqual(10.0f, track[2.0f], 0.001f);
        }
Esempio n. 2
0
        public void Basics()
        {
            AnimationTrack<float> track;

            track = new AnimationTrack<float>(0.0f, 1.0f);
            for (int i = 0; i <= 100; i++)
            {
                float time = (float)i / 100.0f;
                Assert.AreEqual(time, track[time], 0.001f);
            }
            track.ScaleToDuration(10.0f);
            for (int i = 0; i <= 100; i++)
            {
                float time = (float)i / 100.0f;
                Assert.AreEqual(time, track[10.0f * time], 0.001f);
            }

            track = new AnimationTrack<float>
            {
                { 0.5f, 10.0f },
                { 1.0f, 20.0f },
                { 1.5f, 30.0f }
            };
            Assert.AreEqual(10.0f, track[0.0f], 0.001f);
            Assert.AreEqual(30.0f, track[2.0f], 0.001f);

            track.IsLooping = true;
            Assert.AreEqual(10.0f, track[0.0f], 0.001f);
            Assert.AreEqual(10.0f, track[2.0f], 0.001f);
        }