Пример #1
0
        public static void TestTintBy()
        {
            Color       colourStart  = new Color(0.4f, 0.2f, 0.7f, 0.5f);
            Color       colourOffset = 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.TintBy(colourRef, colourOffset, 1.0)
                           )
                );

            queue.Update(0.5);
            AreEqual(colourVal, new Color(0.55f, 0.4f, 0.775f, 0.625f), 0.001f);
            colourVal = colourStart;
            queue.Update(0.5);
            AreEqual(colourVal, new Color(0.55f, 0.4f, 0.775f, 0.625f), 0.001f);
            queue.Update(0.5);
            AreEqual(colourVal, new Color(0.7f, 0.6f, 0.85f, 0.75f), 0.001f);
        }