Exemplo n.º 1
0
        private void UpdateOpenedBookTransform(float progress)
        {
            //scale
            var openedProgress = 1 - progress;
            var openedScale    = MathUtility.Lerp(SelectedBookScale3D.X, 1, openedProgress);
            var scaleMatrix    = Matrix3D.CreateScale(openedScale);

            //rotation
            var openedBookQuaternion = Matrix3DHelper.Slerp(SelectedBookRotation3D, openedBookTargetQuaternion,
                                                            openedProgress, true);
            var rotationM3D = Matrix3D.CreateFromQuaternion(openedBookQuaternion);

            //translation
            var openedX = MathUtility.Lerp(SelectedBookTranslation3D.X, OpenedBookRect.X + (float)Book.CoverWidth,
                                           openedProgress);
            var openedY           = MathUtility.Lerp(SelectedBookTranslation3D.Y, OpenedBookRect.Y, openedProgress);
            var translationMatrix = Matrix3D.CreateTranslation(openedX, openedY, 0);

            OpenedBook.TransformMatrix3D = rotationM3D * scaleMatrix * translationMatrix;
        }