Пример #1
0
        public void KeyFramesAddWithObjectAndAlphaFunc()
        {
            tlog.Debug(tag, $"KeyFramesAddWithObjectAndAlphaFunc START");

            var testingTarget = new KeyFrames();

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <KeyFrames>(testingTarget, "should be an instance of KeyFrames class!");

            Position      pos    = new Position(10.0f, 20.0f, 30.0f);
            AlphaFunction linear = new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear);

            try
            {
                testingTarget.Add(0.3f, pos, linear);
                Assert.IsTrue("Vector3" == testingTarget.GetType().ToString());
            }
            catch (Exception e)
            {
                tlog.Error(tag, "Caught Exception" + e.ToString());
                LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
                Assert.Fail("Caught Exception" + e.ToString());
            }

            pos.Dispose();
            linear.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"KeyFramesAddWithObjectAndAlphaFunc END (OK)");
        }
Пример #2
0
        public void AnimationAnimateBetweenWithStartTimeAndEndTime()
        {
            tlog.Debug(tag, $"AnimationAnimateBetweenWithStartTimeAndEndTime START");

            View view = new View()
            {
                Opacity = 0.0f
            };

            var keyFrames = new KeyFrames();

            Assert.IsNotNull(keyFrames, "should be not null");
            Assert.IsInstanceOf <KeyFrames>(keyFrames, "should be an instance of Animation class!");
            keyFrames.Add(0.0f, 1.0f);

            var testingTarget = new Animation(600);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <Animation>(testingTarget, "should be an instance of Animation class!");

            testingTarget.EndAction = Animation.EndActions.StopFinal;
            testingTarget.AnimateBetween(view, "Opacity", keyFrames, 0, 600);

            testingTarget.Dispose();
            keyFrames.Dispose();
            view.Dispose();
            tlog.Debug(tag, $"AnimationAnimateBetweenWithStartTimeAndEndTime END (OK)");
        }
Пример #3
0
        public void KeyFramesAddWithPropertyValueAndAlphaFunc()
        {
            tlog.Debug(tag, $"KeyFramesAddWithPropertyValueAndAlphaFunc START");

            var testingTarget = new KeyFrames();

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <KeyFrames>(testingTarget, "should be an instance of KeyFrames class!");

            PropertyValue dummy = new PropertyValue(true);
            AlphaFunction ease  = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOut);

            try
            {
                testingTarget.Add(0.3f, dummy, ease);
                Assert.IsTrue("Boolean" == testingTarget.GetType().ToString());
            }
            catch (Exception e)
            {
                tlog.Error(tag, "Caught Exception" + e.ToString());
                LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
                Assert.Fail("Caught Exception" + e.ToString());
            }

            dummy.Dispose();
            ease.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"KeyFramesAddWithPropertyValueAndAlphaFunc END (OK)");
        }
Пример #4
0
        public void KeyFramesConstructor()
        {
            tlog.Debug(tag, $"KeyFramesConstructor START");

            var testingTarget = new KeyFrames();

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <KeyFrames>(testingTarget, "should be an instance of KeyFrames class!");

            testingTarget.Dispose();
            tlog.Debug(tag, $"KeyFramesConstructor END (OK)");
        }
        public override void OnControlStateChanged(Button button, View.ControlStateChangedEventArgs args)
        {
            if (button.ControlState != ControlState.Pressed)
            {
                return;
            }

            var overlayImage = button.OverlayImage;

            if (overlayImage == null)
            {
                return;
            }

            if (null == PressAnimation)
            {
                var keyFrames = new KeyFrames();
                keyFrames.Add(0.0f, 0.0f);
                AlphaFunction linear = new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear);
                keyFrames.Add(0.25f, 1.0f, linear);
                linear.Dispose();
                AlphaFunction ease = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOut);
                keyFrames.Add(1.0f, 0.0f, ease);
                ease.Dispose();

                PressAnimation           = new Animation(600);
                PressAnimation.EndAction = Animation.EndActions.StopFinal;
                PressAnimation.AnimateBetween(overlayImage, "Opacity", keyFrames);
                keyFrames.Dispose();
                Vector3       vec     = new Vector3(1, 1, 1);
                AlphaFunction easeout = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOut);
                PressAnimation.AnimateTo(overlayImage, "Scale", vec, 0, 600, easeout);
                vec.Dispose();
                easeout.Dispose();
            }

            if (PressAnimation.State == Animation.States.Playing)
            {
                PressAnimation.Stop();
                overlayImage.Hide();
            }

            overlayImage.Opacity      = 0.0f;
            overlayImage.CornerRadius = button.CornerRadius;
            overlayImage.Background   = button.Background;
            overlayImage.Size         = button.Size;
            overlayImage.Scale        = new Vector3(0.80f, 0.80f, 1);
            overlayImage.Show();

            PressAnimation.Play();
        }
Пример #6
0
        public void KeyFramesAddWithObject()
        {
            tlog.Debug(tag, $"KeyFramesAddWithObject START");

            var testingTarget = new KeyFrames();

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <KeyFrames>(testingTarget, "should be an instance of KeyFrames class!");

            Position pos = new Position(10.0f, 20.0f, 30.0f);

            testingTarget.Add(0.3f, pos);

            var result = testingTarget.GetType().ToString();

            Assert.IsTrue("Vector3" == result);

            testingTarget.Dispose();
            tlog.Debug(tag, $"KeyFramesAddWithObject END (OK)");
        }
Пример #7
0
        public void KeyFramesGetType()
        {
            tlog.Debug(tag, $"KeyFramesGetType START");

            var testingTarget = new KeyFrames();

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <KeyFrames>(testingTarget, "should be an instance of KeyFrames class!");

            Color color = Color.Yellow;

            testingTarget.Add(0.3f, color);

            var result = testingTarget.GetType().ToString();

            Assert.IsTrue("Vector4" == result);

            testingTarget.Dispose();
            tlog.Debug(tag, $"KeyFramesGetType END (OK)");
        }
Пример #8
0
        public void KeyFramesAddWithPropertyValue()
        {
            tlog.Debug(tag, $"KeyFramesAddWithPropertyValue START");

            var testingTarget = new KeyFrames();

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <KeyFrames>(testingTarget, "should be an instance of KeyFrames class!");

            PropertyValue dummy = new PropertyValue(true);

            testingTarget.Add(0.3f, dummy);

            var result = testingTarget.GetType().ToString();

            Assert.IsTrue("Boolean" == result);

            dummy.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"KeyFramesAddWithPropertyValue END (OK)");
        }