コード例 #1
0
        public void RelativeVector4Constructor()
        {
            tlog.Debug(tag, $"RelativeVector4Constructor START");

            var testingTarget = new RelativeVector4();

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector4");
            Assert.IsInstanceOf <RelativeVector4>(testingTarget, "Should return Vector4 instance.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector4Constructor END (OK)");
        }
コード例 #2
0
ファイル: TSKeyValue.cs プロジェクト: wonrst/TizenFX
        public void KeyValueRelativeVector4Value()
        {
            tlog.Debug(tag, $"KeyValueRelativeVector4Value START");

            using (RelativeVector4 rVec4 = new RelativeVector4(0, 0, 0, 0))
            {
                keyValue.RelativeVector4Value = rVec4;
                tlog.Debug(tag, "RelativeVector4Value : " + keyValue.RelativeVector4Value);
            }

            tlog.Debug(tag, $"KeyValueRelativeVector4Value END (OK)");
        }
コード例 #3
0
        public override string ConvertToString(object value)
        {
            RelativeVector4 vector = value as RelativeVector4;

            if (null != vector)
            {
                return(vector.X.ToString() + " " + vector.Y.ToString() + " " + vector.Z.ToString() + " " + vector.W.ToString());
            }
            else
            {
                return(null);
            }
        }
コード例 #4
0
        public void RelativeVector4GetW()
        {
            tlog.Debug(tag, $"RelativeVector4GetW START");

            var testingTarget = new RelativeVector4(0.5f, 0.6f, 0.7f, 0.8f);

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector4");
            Assert.IsInstanceOf <RelativeVector4>(testingTarget, "Should return Vector4 instance.");

            testingTarget.W = 1.0f;
            Assert.AreEqual(1.0f, testingTarget.W, "Should be equal!");

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector4GetW END (OK)");
        }
コード例 #5
0
        public void RelativeVector4GetHashCode()
        {
            tlog.Debug(tag, $"RelativeVector4GetHashCode START");

            var testingTarget = new RelativeVector4(10.0f, 20.0f, 30.0f, 40.0f);

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector4");
            Assert.IsInstanceOf <RelativeVector4>(testingTarget, "Should be an instance of RelativeVector4 type.");

            var result = testingTarget.GetHashCode();

            Assert.IsTrue(result >= Int32.MinValue && result <= Int32.MaxValue, "The value of hash is out of Integer range");

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector4GetHashCode END (OK)");
        }
コード例 #6
0
        public void RelativeVector4ConstructorWithFloat()
        {
            tlog.Debug(tag, $"RelativeVector4ConstructorWithFloat START");

            var testingTarget = new RelativeVector4(0.5f, 0.6f, 0.7f, 0.8f);

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector4");
            Assert.IsInstanceOf <RelativeVector4>(testingTarget, "Should return Vector4 instance.");

            Assert.AreEqual(0.5f, testingTarget.X, "Retrieved vector.X should be equal to set value");
            Assert.AreEqual(0.6f, testingTarget.Y, "Retrieved vector.Y should be equal to set value");
            Assert.AreEqual(0.7f, testingTarget.Z, "Retrieved vector.Z should be equal to set value");
            Assert.AreEqual(0.8f, testingTarget.W, "Retrieved vector.W should be equal to set value");

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector4ConstructorWithFloat END (OK)");
        }
コード例 #7
0
        public void RelativeVector4NotEqualTo()
        {
            tlog.Debug(tag, $"RelativeVector4NotEqualTo START");

            var testingTarget = new RelativeVector4(1.0f, 0.5f, 0.4f, 0.3f);

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector4");
            Assert.IsInstanceOf <RelativeVector4>(testingTarget, "Should return Vector4 instance.");

            using (RelativeVector4 vector = new RelativeVector4(1.0f, 0.5f, 0.6f, 0.7f))
            {
                Assert.IsTrue((testingTarget.NotEqualTo(vector)), "Should be equal");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector4NotEqualTo END (OK)");
        }
コード例 #8
0
        public void RelativeVector4GetVauleBySubscriptIndex()
        {
            tlog.Debug(tag, $"RelativeVector4GetVauleBySubscriptIndex START");

            var testingTarget = new RelativeVector4(0.5f, 0.6f, 0.7f, 0.8f);

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector4");
            Assert.IsInstanceOf <RelativeVector4>(testingTarget, "Should return Vector4 instance.");

            Assert.AreEqual(0.5f, testingTarget[0], "this[0] should return 100.0f");
            Assert.AreEqual(0.6f, testingTarget[1], "this[1] should return 200.0f");
            Assert.AreEqual(0.7f, testingTarget[2], "this[2] should return 300.0f");
            Assert.AreEqual(0.8f, testingTarget[3], "this[3] should return 400.0f");

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector4GetVauleBySubscriptIndex END (OK)");
        }
コード例 #9
0
        public void KeyValueRelativeVector4Value()
        {
            tlog.Debug(tag, $"KeyValueRelativeVector4Value START");

            RelativeVector4 b1 = new RelativeVector4(0, 0, 0, 0);
            KeyValue        a1 = new KeyValue
            {
                RelativeVector4Value = b1
            };

            b1 = a1.RelativeVector4Value;

            b1.Dispose();
            a1.Dispose();
            tlog.Debug(tag, $"KeyValueRelativeVector4Value END (OK)");
            Assert.Pass("KeyValueRelativeVector4Value");
        }
コード例 #10
0
ファイル: TSRelativeVector2.cs プロジェクト: yunmiha/TizenFX
        public void RelativeVector2ConstructorWithRelativeVector4()
        {
            tlog.Debug(tag, $"RelativeVector2ConstructorWithRelativeVector4 START");

            using (RelativeVector4 vec4 = new RelativeVector4(0.5f, 0.6f, 0.7f, 0.8f))
            {
                var testingTarget = new RelativeVector2(vec4);
                Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector2");
                Assert.IsInstanceOf <RelativeVector2>(testingTarget, "Should return RelativeVector2 instance.");

                Assert.AreEqual(0.5f, testingTarget.X, "Retrieved vector.X should be equal to set value");
                Assert.AreEqual(0.6f, testingTarget.Y, "Retrieved vector.Y should be equal to set value");

                testingTarget.Dispose();
            }

            tlog.Debug(tag, $"RelativeVector2ConstructorWithRelativeVector4 END (OK)");
        }
コード例 #11
0
        public void RelativeVector4ImplicitToVector4()
        {
            tlog.Debug(tag, $"RelativeVector4ImplicitToVector4 START");

            Vector4 testingTarget = null;

            using (RelativeVector4 vector = new RelativeVector4(0.5f, 0.6f, 0.7f, 0.8f))
            {
                testingTarget = vector;
                Assert.AreEqual(vector.X, testingTarget.X, "The value of X is not correct.");
                Assert.AreEqual(vector.Y, testingTarget.Y, "The value of Y is not correct.");
                Assert.AreEqual(vector.Z, testingTarget.Z, "The value of Z is not correct.");
                Assert.AreEqual(vector.W, testingTarget.W, "The value of W is not correct.");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector4ImplicitToVector4 END (OK)");
        }
コード例 #12
0
        public void RelativeVector4Equals()
        {
            tlog.Debug(tag, $"RelativeVector4Equals START");

            var testingTarget = new RelativeVector4(0.02f, 0.02f, 0.02f, 0.02f);

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector4");
            Assert.IsInstanceOf <RelativeVector4>(testingTarget, "Should return Vector4 instance.");

            using (RelativeVector4 vector = new RelativeVector4(0.02f, 0.02f, 0.02f, 0.02f))
            {
                var result = testingTarget.Equals(vector);
                Assert.IsTrue(result, "Should be true here!");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector4Equals END (OK)");
        }
コード例 #13
0
        public void RelativeVector4DivisionByFloat()
        {
            tlog.Debug(tag, $"RelativeVector4DivisionByFloat START");

            var testingTarget = new RelativeVector4(0.5f, 0.6f, 0.7f, 0.8f);

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector4");
            Assert.IsInstanceOf <RelativeVector4>(testingTarget, "Should return Vector4 instance.");

            var result = testingTarget / 2.0f;

            Assert.Less(Math.Abs(0.25f - result.X), 0.0001f, "The X of the vector is not correct here!");
            Assert.Less(Math.Abs(0.3f - result.Y), 0.0001f, "The Y of the vector is not correct here!");
            Assert.Less(Math.Abs(0.35f - result.Z), 0.0001f, "The Z of the vector is not correct here!");
            Assert.Less(Math.Abs(0.4f - result.W), 0.0001f, "The W of the vector is not correct here!");

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector4DivisionByFloat END (OK)");
        }
コード例 #14
0
        public void RelativeVector4Dispose()
        {
            tlog.Debug(tag, $"RelativeVector4Dispose START");

            var testingTarget = new RelativeVector4(10.0f, 20.0f, 30.0f, 40.0f);

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector4");
            Assert.IsInstanceOf <RelativeVector4>(testingTarget, "Should return Vector4 instance.");

            try
            {
                testingTarget.Dispose();
            }
            catch (Exception e)
            {
                Assert.Fail("Caught Exception" + e.ToString());
            }

            tlog.Debug(tag, $"RelativeVector4Dispose END (OK)");
        }
コード例 #15
0
        public void RelativeVector4MultiplyByRelativeVector4()
        {
            tlog.Debug(tag, $"RelativeVector4MultiplyByRelativeVector4 START");

            var testingTarget = new RelativeVector4(0.5f, 0.6f, 0.7f, 0.8f);

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector4");
            Assert.IsInstanceOf <RelativeVector4>(testingTarget, "Should return Vector4 instance.");

            using (RelativeVector4 vector = new RelativeVector4(0.4f, 0.3f, 0.2f, 0.1f))
            {
                var result = testingTarget * vector;
                Assert.Less(Math.Abs(0.2f - result.X), 0.0001f, "The X of the vector is not correct here!");
                Assert.Less(Math.Abs(0.18f - result.Y), 0.0001f, "The Y of the vector is not correct here!");
                Assert.Less(Math.Abs(0.14f - result.Z), 0.0001f, "The Z of the vector is not correct here!");
                Assert.Less(Math.Abs(0.08f - result.W), 0.0001f, "The W of the vector is not correct here!");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"RelativeVector4MultiplyByRelativeVector4 END (OK)");
        }
コード例 #16
0
        public void RelativeVector4TypeConverterConvertToString()
        {
            tlog.Debug(tag, $"RelativeVector4TypeConverterConvertToString START");

            var testingTarget = new RelativeVector4TypeConverterImpl();

            Assert.IsNotNull(testingTarget, "Can't create success object RelativeVector4TypeConverter.");
            Assert.IsInstanceOf <RelativeVector4TypeConverter>(testingTarget, "Should return RelativeVector4TypeConverter instance.");

            // null
            var result = testingTarget.ConvertToString(0.3f);

            tlog.Debug(tag, "ConvertToString : " + result);

            using (RelativeVector4 vec = new RelativeVector4(0.1f, 0.3f, 0.5f, 0.0f))
            {
                result = testingTarget.ConvertToString(vec);
                tlog.Debug(tag, "ConvertToString : " + result);
            }

            tlog.Debug(tag, $"RelativeVector4TypeConverterConvertToString END");
        }
コード例 #17
0
        public override object ConvertFromInvariantString(string value)
        {
            if (value != null)
            {
                string[] parts = value.Split(TypeConverter.UnifiedDelimiter);
                if (parts.Length == 4)
                {
                    return(new RelativeVector4(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
                                               Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture),
                                               Single.Parse(parts[2].Trim(), CultureInfo.InvariantCulture),
                                               Single.Parse(parts[3].Trim(), CultureInfo.InvariantCulture)));
                }
                else if (parts.Length == 3)
                {
                    var vector3 = new RelativeVector3(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
                                                      Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture),
                                                      Single.Parse(parts[2].Trim(), CultureInfo.InvariantCulture));
                    var vector4 = new RelativeVector4(vector3);
                    vector3.Dispose();
                    return(vector4);
                }
                else if (parts.Length == 2)
                {
                    var vector2 = new RelativeVector2(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
                                                      Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture));
                    var vector4 = new RelativeVector4(vector2);
                    vector2.Dispose();
                    return(vector4);
                }
                else if (parts.Length == 1)
                {
                    var x = Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture);
                    return(new RelativeVector4(x, x, x, x));
                }
            }

            throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(RelativeVector4)}");
        }
コード例 #18
0
        void Initialize()
        {
            Window.Instance.KeyEvent += OnKeyEvent;

            image          = new ImageView();
            image.Size2D   = new Size2D(500, 200);
            image.Position = new Position(750, 275, 0);
            image.PositionUsesPivotPoint = true;
            image.PivotPoint             = PivotPoint.TopLeft;
            image.ParentOrigin           = ParentOrigin.TopLeft;
            image.SetImage(DirectoryInfo.Resource + "tizen_image.jpg");
            Window.Instance.GetDefaultLayer().Add(image);

            _opacityButton     = CreateButton("OpacityAnimation");
            _orientationButton = CreateButton("OrientationAnimation");
            _pixelAreaButton   = CreateButton("pixelAreaAnimation");

            _opacityButton.Clicked     += ButtonClick;
            _orientationButton.Clicked += ButtonClick;
            _pixelAreaButton.Clicked   += ButtonClick;

            TableView tableView = new TableView(1, 3);

            tableView.Size2D       = new Size2D(1300, 330);
            tableView.PivotPoint   = PivotPoint.TopLeft;
            tableView.ParentOrigin = ParentOrigin.TopLeft;
            tableView.Position2D   = new Position2D(400, 800);

            tableView.AddChild(_orientationButton, new TableView.CellPosition(0, 0));
            tableView.AddChild(_opacityButton, new TableView.CellPosition(0, 1));
            tableView.AddChild(_pixelAreaButton, new TableView.CellPosition(0, 2));

            Window.Instance.GetDefaultLayer().Add(tableView);

            opacityAnimation     = new Animation();
            orientationAnimation = new Animation();
            pixelAreaAnimation   = new Animation();

            opacityAnimation = new Animation(1500);
            opacityAnimation.AnimateTo(image, "Opacity", 0.5f, 0, 400);
            opacityAnimation.AnimateTo(image, "Opacity", 0.0f, 400, 800);
            opacityAnimation.AnimateTo(image, "Opacity", 0.7f, 800, 1250);
            opacityAnimation.AnimateTo(image, "Opacity", 1.0f, 1250, 1500);
            opacityAnimation.EndAction = Animation.EndActions.StopFinal;

            orientationAnimation = new Animation();
            orientationAnimation.AnimateTo(image, "Orientation", new Rotation(new Radian(new Degree(200.0f)), PositionAxis.X), 0, 400);
            orientationAnimation.AnimateTo(image, "Orientation", new Rotation(new Radian(new Degree(60.0f)), PositionAxis.Y), 400, 800);
            orientationAnimation.AnimateTo(image, "Orientation", new Rotation(new Radian(new Degree(30.0f)), PositionAxis.Z), 800, 1000);
            orientationAnimation.AnimateTo(image, "Orientation", new Rotation(new Radian(0.0f), PositionAxis.X), 1000, 1400);
            orientationAnimation.AnimateTo(image, "Orientation", new Rotation(new Radian(0.0f), PositionAxis.Y), 1400, 1800);
            orientationAnimation.AnimateTo(image, "Orientation", new Rotation(new Radian(0.0f), PositionAxis.Z), 1800, 2200);
            orientationAnimation.EndAction = Animation.EndActions.StopFinal;

            pixelAreaAnimation = new Animation(2000);
            RelativeVector4 vec1 = new RelativeVector4(0.0f, 0.0f, 1.0f, 0.3f);
            RelativeVector4 vec2 = new RelativeVector4(0.6f, 0.0f, 1.0f, 0.4f);
            RelativeVector4 vec3 = new RelativeVector4(0.0f, 0.0f, 1.0f, 1.0f);

            pixelAreaAnimation.AnimateTo(image, "pixelArea", vec1, 0, 500);
            pixelAreaAnimation.AnimateTo(image, "pixelArea", vec2, 500, 1000);
            pixelAreaAnimation.AnimateTo(image, "pixelArea", vec3, 1500, 2000);
            pixelAreaAnimation.EndAction = Animation.EndActions.StopFinal;
        }
コード例 #19
0
ファイル: ImageView.cs プロジェクト: xerrni/TizenFX
 private void OnPixelAreaChanged(float x, float y, float z, float w)
 {
     PixelArea = new RelativeVector4(x, y, z, w);
 }
コード例 #20
0
ファイル: VectorTypeConverter.cs プロジェクト: upple/TizenFX
        public override string ConvertToString(object value)
        {
            RelativeVector4 vector = (RelativeVector4)value;

            return(vector.X.ToString() + " " + vector.Y.ToString() + " " + vector.Z.ToString() + " " + vector.W.ToString());;
        }
コード例 #21
0
        /// <summary>
        /// Animation Sample Application initialisation.
        /// </summary>
        private void Initialize()
        {
            Window.Instance.BackgroundColor = Color.Black;
            View focusIndicator = new View();

            FocusManager.Instance.FocusIndicator = focusIndicator;

            _positionButton             = CreateButton("Position", "PositionAnimation");
            _sizeButton                 = CreateButton("Size", "SizeAnimation");
            _scaleButton                = CreateButton("Scale", "ScaleAnimation");
            _orientationButton          = CreateButton("Orientation", "OrientationAnimation");
            _opacityButton              = CreateButton("Opacity", "OpacityAnimation");
            _pixelAreaButton            = CreateButton("PixelArea", "PixelAreaAnimation");
            _PositionSizeOpacity        = CreateButton("PositionSizeOpacity", "Position + Size + Opacity animation at same time!");
            _PositionSizeOpacity.Size2D = new Size2D(1400, 80);
            //Set the callback of button's clicked event
            _positionButton.ClickEvent      += ButtonClick;
            _sizeButton.ClickEvent          += ButtonClick;
            _scaleButton.ClickEvent         += ButtonClick;
            _orientationButton.ClickEvent   += ButtonClick;
            _opacityButton.ClickEvent       += ButtonClick;
            _pixelAreaButton.ClickEvent     += ButtonClick;
            _PositionSizeOpacity.ClickEvent += ButtonClick;

            //Create a tableView as the container of the pushButton.
            TableView tableView = new TableView(3, 3);

            tableView.Size2D       = new Size2D(1500, 440);
            tableView.PivotPoint   = PivotPoint.TopLeft;
            tableView.ParentOrigin = ParentOrigin.TopLeft;
            tableView.Position2D   = new Position2D(260, 630);

            tableView.AddChild(_positionButton, new TableView.CellPosition(0, 0));
            tableView.AddChild(_sizeButton, new TableView.CellPosition(0, 1));
            tableView.AddChild(_scaleButton, new TableView.CellPosition(0, 2));
            tableView.AddChild(_orientationButton, new TableView.CellPosition(1, 0));
            tableView.AddChild(_opacityButton, new TableView.CellPosition(1, 1));
            tableView.AddChild(_pixelAreaButton, new TableView.CellPosition(1, 2));
            tableView.AddChild(_PositionSizeOpacity, new TableView.CellPosition(2, 0, 1, 3));

            Window.Instance.GetDefaultLayer().Add(tableView);
            FocusManager.Instance.SetCurrentFocusView(_positionButton);

            //This textLable is used to show the title.
            guide = new TextLabel();
            guide.HorizontalAlignment = HorizontalAlignment.Center;
            guide.VerticalAlignment   = VerticalAlignment.Center;
            //guide.BackgroundColor = new Color(43.0f / 255.0f, 145.0f / 255.0f, 175.0f / 255.0f, 1.0f);
            guide.TextColor = Color.White;
            guide.PositionUsesPivotPoint = true;
            guide.ParentOrigin           = ParentOrigin.TopLeft;
            guide.PivotPoint             = PivotPoint.TopLeft;
            guide.Size2D     = new Size2D(1920, 96);
            guide.FontFamily = "Samsung One 600";
            guide.Position2D = new Position2D(0, 94);
            guide.MultiLine  = false;
            //guide.PointSize = 15.0f;
            guide.PointSize = PointSize15;

            guide.Text = "Animation Sample";
            Window.Instance.GetDefaultLayer().Add(guide);

            // Create the view to animate.
            view          = new ImageView();
            view.Size2D   = new Size2D(200, 200);
            view.Position = new Position(860, 275, 0);
            view.PositionUsesPivotPoint = true;
            view.PivotPoint             = PivotPoint.TopLeft;
            view.ParentOrigin           = ParentOrigin.TopLeft;
            view.ResourceUrl            = resources + "/gallery-2.jpg";

            // Add view on Window.
            Window.Instance.GetDefaultLayer().Add(view);

            // Create the position animation.
            // The duration of the animation is 1.5s;
            positionAnimation          = new Animation();
            positionAnimation.Duration = 1500;
            // Sets the default alpha function for the animation.
            positionAnimation.DefaultAlphaFunction = new AlphaFunction(new Vector2(0.3f, 0), new Vector2(0.15f, 1));
            // To reset the view's position.
            positionAnimation.AnimateTo(view, "Position", new Position(100, 150, 0), 0, 0);
            positionAnimation.AnimateTo(view, "Position", new Position(300, 200, 0), 0, 300);
            positionAnimation.AnimateTo(view, "Position", new Position(500, 200, 0), 0, 800);
            positionAnimation.AnimateTo(view, "Position", new Position(600, 250, 0), 0, 1000);
            positionAnimation.AnimateTo(view, "Position", new Position(860, 265, 0), 0, 1500);
            //StopFinal: If the animation is stopped, the animated property values are saved as if the animation had run to completion
            positionAnimation.EndAction = Animation.EndActions.StopFinal;

            // Create the size animation using AnimateTo.
            sizeAnimation = new Animation(1000);
            sizeAnimation.AnimateTo(view, "size", new Vector3(view.SizeWidth, view.SizeHeight, 0));
            sizeAnimation.AnimateTo(view, "sizeWidth", view.SizeWidth * 1.25f);
            sizeAnimation.AnimateTo(view, "sizeHeight", view.SizeHeight * 1.25f);
            sizeAnimation.AnimateTo(view, "sizeDepth", 0);
            //StopFinal: If the animation is stopped, the animated property values are saved as if the animation had run to completion
            sizeAnimation.EndAction = Animation.EndActions.StopFinal;

            // Create the scale animation using AnimateTo.
            scaleAnimation = new Animation(1500);
            scaleAnimation.AnimateTo(view, "scale", new Vector3(1.2f, 1.2f, 1.0f), 0, 200, new AlphaFunction(AlphaFunction.BuiltinFunctions.Sin));
            scaleAnimation.AnimateTo(view, "scaleX", 1.5f, 200, 500, new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear));
            scaleAnimation.AnimateTo(view, "ScaleY", 1.5f, 500, 800, new AlphaFunction(AlphaFunction.BuiltinFunctions.Bounce));
            scaleAnimation.AnimateTo(view, "scaleX", 1.0f, 800, 1200, new AlphaFunction(AlphaFunction.BuiltinFunctions.Bounce));
            scaleAnimation.AnimateTo(view, "scaleX", 1.0f, 1200, 1500, new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear));
            //StopFinal: If the animation is stopped, the animated property values are saved as if the animation had run to completion
            scaleAnimation.EndAction = Animation.EndActions.StopFinal;

            // Create the orientation animation using AnimateTo.
            orientationAnimation = new Animation();
            orientationAnimation.AnimateTo(view, "Orientation", new Rotation(new Radian(new Degree(60.0f)), PositionAxis.X), 0, 400);
            orientationAnimation.AnimateTo(view, "Orientation", new Rotation(new Radian(new Degree(60.0f)), PositionAxis.Y), 400, 800);
            orientationAnimation.AnimateTo(view, "Orientation", new Rotation(new Radian(new Degree(60.0f)), PositionAxis.Z), 800, 1000);
            orientationAnimation.AnimateTo(view, "Orientation", new Rotation(new Radian(0.0f), PositionAxis.X), 1000, 1400);
            orientationAnimation.AnimateTo(view, "Orientation", new Rotation(new Radian(0.0f), PositionAxis.Y), 1400, 1800);
            orientationAnimation.AnimateTo(view, "Orientation", new Rotation(new Radian(0.0f), PositionAxis.Z), 1800, 2200);
            //StopFinal: If the animation is stopped, the animated property values are saved as if the animation had run to completion
            orientationAnimation.EndAction = Animation.EndActions.StopFinal;

            // Create the Opacity animation using AnimateTo.
            opacityAnimation = new Animation(1500);
            opacityAnimation.AnimateTo(view, "Opacity", 0.5f, 0, 400);
            opacityAnimation.AnimateTo(view, "Opacity", 0.0f, 400, 800);
            opacityAnimation.AnimateTo(view, "Opacity", 0.5f, 800, 1250);
            opacityAnimation.AnimateTo(view, "Opacity", 1.0f, 1250, 1500);
            //StopFinal: If the animation is stopped, the animated property values are saved as if the animation had run to completion
            opacityAnimation.EndAction = Animation.EndActions.StopFinal;

            // Create the pixelArea animation using AnimateTo.
            pixelArealAnimation = new Animation(2000);
            RelativeVector4 vec1 = new RelativeVector4(0.0f, 0.0f, 0.5f, 0.5f);
            RelativeVector4 vec2 = new RelativeVector4(0.0f, 0.0f, 0.0f, 0.0f);
            RelativeVector4 vec3 = new RelativeVector4(0.0f, 0.0f, 1.0f, 1.0f);

            pixelArealAnimation.AnimateTo(view, "pixelArea", vec1, 0, 500);
            pixelArealAnimation.AnimateTo(view, "pixelArea", vec2, 500, 1000);
            pixelArealAnimation.AnimateTo(view, "pixelArea", vec1, 1000, 1500);
            pixelArealAnimation.AnimateTo(view, "pixelArea", vec3, 1500, 2000);
            //StopFinal: If the animation is stopped, the animated property values are saved as if the animation had run to completion
            pixelArealAnimation.EndAction = Animation.EndActions.StopFinal;

            view.Focusable            = true;
            Window.Instance.KeyEvent += AppBack;
        }
コード例 #22
0
        /// <summary>
        /// Create Animations which animate properties of ImageView
        /// </summary>
        private void CreateAnimations()
        {
            mAnimations = new Animation[mAnimationCount];

            // Position animation
            mAnimations[0] = new Animation();
            // The duration of the animation is 1.5s;
            mAnimations[0].Duration = 1500;
            // Create the position animation using AnimateTo.
            mAnimations[0].AnimateTo(mImageView, "Position", new Position(-mImageSize.Width / 2, 0, 0), 0, 500);
            mAnimations[0].AnimateTo(mImageView, "Position", new Position(mImageSize.Width / 2, 0, 0), 501, 1000);
            mAnimations[0].AnimateTo(mImageView, "Position", new Position(0, 0, 0), 1001, 1500);
            // StopFinal: If the animation is stopped, the animated property values are saved as if the animation had run to completion
            mAnimations[0].EndAction = Animation.EndActions.StopFinal;

            // Size animation
            mAnimations[1] = new Animation();
            // The duration of the animation is 1.0s;
            mAnimations[1].Duration = 1000;
            // Create the size animation using AnimateTo.
            mAnimations[1].AnimateTo(mImageView, "size", new Vector3(mImageSize.Width, mImageSize.Width, 0) * 1.25f, 0, 500);
            mAnimations[1].AnimateTo(mImageView, "size", new Vector3(mImageSize.Width, mImageSize.Width, 0), 501, 1000);
            // StopFinal: If the animation is stopped, the animated property values are saved as if the animation had run to completion
            mAnimations[1].EndAction = Animation.EndActions.StopFinal;

            // Scale animation
            mAnimations[2] = new Animation();
            // The duration of the animation is 1.5s;
            mAnimations[2].Duration = 1500;
            // Create the scale animation using AnimateTo.
            mAnimations[2].AnimateTo(mImageView, "scale", new Vector3(1.2f, 1.2f, 1.0f), 0, 200, new AlphaFunction(AlphaFunction.BuiltinFunctions.Sin));
            mAnimations[2].AnimateTo(mImageView, "scaleX", 1.3f, 200, 500, new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear));
            mAnimations[2].AnimateTo(mImageView, "ScaleY", 1.3f, 500, 800, new AlphaFunction(AlphaFunction.BuiltinFunctions.Bounce));
            mAnimations[2].AnimateTo(mImageView, "scaleX", 1.0f, 800, 1200, new AlphaFunction(AlphaFunction.BuiltinFunctions.Bounce));
            mAnimations[2].AnimateTo(mImageView, "scaleX", 1.0f, 1200, 1500, new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear));
            // StopFinal: If the animation is stopped, the animated property values are saved as if the animation had run to completion
            mAnimations[2].EndAction = Animation.EndActions.StopFinal;

            // Orientation animation
            mAnimations[3] = new Animation();
            // The duration of the animation is 2.2s;
            mAnimations[3].Duration = 2200;
            // Create the orientation animation using AnimateTo.
            mAnimations[3].AnimateTo(mImageView, "Orientation", new Rotation(new Radian(new Degree(60.0f)), PositionAxis.X), 0, 400);
            mAnimations[3].AnimateTo(mImageView, "Orientation", new Rotation(new Radian(new Degree(60.0f)), PositionAxis.Y), 400, 800);
            mAnimations[3].AnimateTo(mImageView, "Orientation", new Rotation(new Radian(new Degree(60.0f)), PositionAxis.Z), 800, 1000);
            mAnimations[3].AnimateTo(mImageView, "Orientation", new Rotation(new Radian(0.0f), PositionAxis.X), 1000, 1400);
            mAnimations[3].AnimateTo(mImageView, "Orientation", new Rotation(new Radian(0.0f), PositionAxis.Y), 1400, 1800);
            mAnimations[3].AnimateTo(mImageView, "Orientation", new Rotation(new Radian(0.0f), PositionAxis.Z), 1800, 2200);
            // StopFinal: If the animation is stopped, the animated property values are saved as if the animation had run to completion
            mAnimations[3].EndAction = Animation.EndActions.StopFinal;

            // Opacity animation
            mAnimations[4] = new Animation();
            // The duration of the animation is 1.5s;
            mAnimations[4].Duration = 1500;
            // Create the Opacity animation using AnimateTo.
            mAnimations[4].AnimateTo(mImageView, "Opacity", 0.5f, 0, 400);
            mAnimations[4].AnimateTo(mImageView, "Opacity", 0.0f, 400, 800);
            mAnimations[4].AnimateTo(mImageView, "Opacity", 0.5f, 800, 1250);
            mAnimations[4].AnimateTo(mImageView, "Opacity", 1.0f, 1250, 1500);
            // StopFinal: If the animation is stopped, the animated property values are saved as if the animation had run to completion
            mAnimations[4].EndAction = Animation.EndActions.StopFinal;

            // PixelArea animation
            mAnimations[5] = new Animation();
            // The duration of the animation is 2.0s;
            mAnimations[5].Duration = 2000;
            // Create the pixelArea animation using AnimateTo.
            RelativeVector4 vec1 = new RelativeVector4(0.0f, 0.0f, 0.5f, 0.5f);
            RelativeVector4 vec2 = new RelativeVector4(0.0f, 0.0f, 0.0f, 0.0f);
            RelativeVector4 vec3 = new RelativeVector4(0.0f, 0.0f, 1.0f, 1.0f);

            mAnimations[5].AnimateTo(mImageView, "pixelArea", vec1, 0, 500);
            mAnimations[5].AnimateTo(mImageView, "pixelArea", vec2, 500, 1000);
            mAnimations[5].AnimateTo(mImageView, "pixelArea", vec1, 1000, 1500);
            mAnimations[5].AnimateTo(mImageView, "pixelArea", vec3, 1500, 2000);
            // StopFinal: If the animation is stopped, the animated property values are saved as if the animation had run to completion
            mAnimations[5].EndAction = Animation.EndActions.StopFinal;
        }