Exemplo n.º 1
0
        public static void TestTintTo()
        {
            Color       colourStart = new Color(0.4f, 0.2f, 0.7f, 0.5f);
            Color       colourEnd   = new Color(0.3f, 0.4f, 0.15f, 0.25f);
            Color       colourVal   = colourStart;
            Ref <Color> colourRef   = new Ref <Color>(
                () => colourVal,
                t => colourVal = t
                );

            CommandQueue queue = new CommandQueue();

            queue.Enqueue(
                Cmd.Repeat(2,
                           Cmd.TintTo(colourRef, colourEnd, 1.0)
                           )
                );

            queue.Update(0.2);
            AreEqual(colourVal, colourStart * 0.8f + colourEnd * 0.2f, 0.001f);
            colourVal = colourStart;
            queue.Update(0.8);
            AreEqual(colourVal, colourEnd, 0.001f);
            queue.Update(0.5);
            AreEqual(colourVal, colourEnd, 0.001f);
        }