public void Can_Interpolate_Rotation(double progress, double angle)
        {
            var from = TransformOperations.Parse("rotate(10deg)");
            var to   = TransformOperations.Parse("rotate(20deg)");

            var interpolated = TransformOperations.Interpolate(from, to, progress);

            var operations = interpolated.Operations;

            Assert.Single(operations);
            Assert.Equal(TransformOperation.OperationType.Rotate, operations[0].Type);
            Assert.Equal(MathUtilities.Deg2Rad(angle), operations[0].Data.Rotate.Angle);
        }
        public void Interpolation_Fallback_To_Matrix()
        {
            double progress = 0.5d;

            var from = TransformOperations.Parse("rotate(45deg)");
            var to   = TransformOperations.Parse("translate(100px, 100px) rotate(1215deg)");

            var interpolated = TransformOperations.Interpolate(from, to, progress);

            var operations = interpolated.Operations;

            Assert.Single(operations);
            Assert.Equal(TransformOperation.OperationType.Matrix, operations[0].Type);
        }
        public void Can_Interpolate_Skew(double progress, double x, double y)
        {
            var from = TransformOperations.Parse("skewX(10deg)");
            var to   = TransformOperations.Parse("skewY(20deg)");

            var interpolated = TransformOperations.Interpolate(from, to, progress);

            var operations = interpolated.Operations;

            Assert.Single(operations);
            Assert.Equal(TransformOperation.OperationType.Skew, operations[0].Type);
            Assert.Equal(MathUtilities.Deg2Rad(x), operations[0].Data.Skew.X);
            Assert.Equal(MathUtilities.Deg2Rad(y), operations[0].Data.Skew.Y);
        }
        public void Can_Interpolate_Scale(double progress, double x, double y)
        {
            var from = TransformOperations.Parse("scaleX(10)");
            var to   = TransformOperations.Parse("scaleY(20)");

            var interpolated = TransformOperations.Interpolate(from, to, progress);

            var operations = interpolated.Operations;

            Assert.Single(operations);
            Assert.Equal(TransformOperation.OperationType.Scale, operations[0].Type);
            Assert.Equal(x, operations[0].Data.Scale.X);
            Assert.Equal(y, operations[0].Data.Scale.Y);
        }
        public void Order_Of_Operations_Is_Preserved_One_Prefix()
        {
            var from = TransformOperations.Parse("scale(1)");
            var to   = TransformOperations.Parse("scale(0.5,0.5) translate(50px,50px)");

            var interpolated_0 = TransformOperations.Interpolate(from, to, 0);

            Assert.True(interpolated_0.IsIdentity);

            var interpolated_50 = TransformOperations.Interpolate(from, to, 0.5);

            AssertMatrix(interpolated_50.Value, scaleX: 0.75, scaleY: 0.75, translateX: 25.0, translateY: 25);

            var interpolated_100 = TransformOperations.Interpolate(from, to, 1);

            AssertMatrix(interpolated_100.Value, scaleX: 0.5, scaleY: 0.5, translateX: 50, translateY: 50);
        }