當前位置: 首頁>>代碼示例>>C#>>正文


C# MatrixTransform.BeginAnimation方法代碼示例

本文整理匯總了C#中System.Windows.Media.MatrixTransform.BeginAnimation方法的典型用法代碼示例。如果您正苦於以下問題:C# MatrixTransform.BeginAnimation方法的具體用法?C# MatrixTransform.BeginAnimation怎麽用?C# MatrixTransform.BeginAnimation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Media.MatrixTransform的用法示例。


在下文中一共展示了MatrixTransform.BeginAnimation方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DLMatrixAnimation

 public DLMatrixAnimation(Matrix fromValue, Matrix toValue, Duration duration, Action<object> frameCallback, IEasingFunction easingFunction = null)
 {
     FrameCallback = frameCallback;
     _matrixTransform = new MatrixTransform();
     _matrixAnimation = new MatrixAnimation(fromValue, toValue, duration);
     if(easingFunction != null)
     {
         _matrixAnimation.EasingFunction = easingFunction;
     }
     _matrixAnimation.Completed += (sender, args) =>
         {
             FrameCallback(_matrixAnimation.To);
             _matrixTransform.BeginAnimation(MatrixTransform.MatrixProperty, null);
         };
 }
開發者ID:deurell,項目名稱:Curla,代碼行數:15,代碼來源:DLMatrixAnimation.cs

示例2: AnimatePutCardMiddleOrRight

        private void AnimatePutCardMiddleOrRight(int iLocationIndex)
        {
            Canvas targetCanves = GetCanvas(iLocationIndex);
            Point pointCanvasCorner = targetCanves.PointToScreen(new Point(0, 0));

            // Create the animation path.
            PathGeometry animationPath = new PathGeometry();
            PathFigure pFigure = new PathFigure();

            PolyBezierSegment pBezierSegment = new PolyBezierSegment();

            pFigure.StartPoint = new Point(-pointCanvasCorner.X + this.ActualWidth / 2, -pointCanvasCorner.Y);
            pBezierSegment.Points.Add(pFigure.StartPoint);
            pBezierSegment.Points.Add(new Point(-targetCanves.ActualWidth, 0));
            pBezierSegment.Points.Add(new Point(0, 0));

            // Create a MatrixTransform. This transform will be used to move the button.
            MatrixTransform matrixTransform = new MatrixTransform();
            targetCanves.RenderTransform = matrixTransform;

            pFigure.Segments.Add(pBezierSegment);
            animationPath.Figures.Add(pFigure);

            // Freeze the PathGeometry for performance benefits.
            animationPath.Freeze();

            // Create a MatrixAnimationUsingPath to move the
            // button along the path by animating its MatrixTransform.
            MatrixAnimationUsingPath matrixAnimation =
                new MatrixAnimationUsingPath();
            matrixAnimation.PathGeometry = animationPath;
            matrixAnimation.Duration = TimeSpan.FromSeconds(iAnimationPutCardTime);

            // Set the animation's DoesRotateWithTangent property
            // to true so that rotates the card in addition to moving it.
            matrixAnimation.DoesRotateWithTangent = true;
            matrixTransform.BeginAnimation(MatrixTransform.MatrixProperty, matrixAnimation);
        }
開發者ID:HarelM,項目名稱:Set-Game,代碼行數:38,代碼來源:MainWindow.xaml.cs

示例3: AnimatePutCard

        private void AnimatePutCard(int iLocationIndex)
        {
            Canvas targetCanves = GetCanvas(iLocationIndex);
            Point pointCanvasCorner = targetCanves.PointToScreen(new Point(0, 0));
            Point pointWindowCorner = PointToScreen(new Point(0, 0));

            // Create the animation path.
            PathGeometry animationPath = new PathGeometry();
            PathFigure pFigure = new PathFigure();

            PolyLineSegment pLineSegment = new PolyLineSegment();
            Point pointStart = new Point();
            pointStart.X = pointWindowCorner.X - pointCanvasCorner.X + this.ActualWidth / 2 - targetCanves.ActualHeight / 4;
            pointStart.Y = pointWindowCorner.Y - pointCanvasCorner.Y - targetCanves.ActualWidth;
            pFigure.StartPoint = pointStart;
            pLineSegment.Points.Add(pFigure.StartPoint);
            pLineSegment.Points.Add(new Point(0, 0));

            // Create a MatrixTransform. This transform will be used to move the button.
            MatrixTransform matrixTransform = new MatrixTransform();
            targetCanves.RenderTransform = matrixTransform;

            pFigure.Segments.Add(pLineSegment);
            animationPath.Figures.Add(pFigure);

            // Freeze the PathGeometry for performance benefits.
            animationPath.Freeze();

            // Create a MatrixAnimationUsingPath to move the
            // button along the path by animating its MatrixTransform.
            MatrixAnimationUsingPath matrixAnimation = new MatrixAnimationUsingPath();
            matrixAnimation.PathGeometry = animationPath;
            matrixAnimation.Duration = TimeSpan.FromSeconds(iAnimationPutCardTime);

            DoubleAnimation doubleAnimation = new DoubleAnimation(90, 360, TimeSpan.FromSeconds(iAnimationPutCardTime));
            RotateTransform renderTransform = new RotateTransform(0, targetCanves.ActualWidth / 2, targetCanves.ActualHeight / 2);//targetCanves.ActualHeight);
            targetCanves.Children[0].RenderTransform = renderTransform;
            renderTransform.BeginAnimation(RotateTransform.AngleProperty, doubleAnimation);

            //matrixAnimation.DoesRotateWithTangent = true;
            matrixTransform.BeginAnimation(MatrixTransform.MatrixProperty, matrixAnimation);
        }
開發者ID:HarelM,項目名稱:Set-Game,代碼行數:42,代碼來源:MainWindow.xaml.cs

示例4: AnimatePutCardLeft

        private void AnimatePutCardLeft(int iLocationIndex)
        {
            Canvas targetCanves = GetCanvas(iLocationIndex);
            Point pointCanvasCorner = targetCanves.PointToScreen(new Point(0, 0));

            // Create the animation path.
            PathGeometry animationPath = new PathGeometry();
            PathFigure pFigure = new PathFigure();

            PolyBezierSegment pBezierSegment = new PolyBezierSegment();
            pFigure.StartPoint = new Point(-pointCanvasCorner.X + this.ActualWidth / 2, -pointCanvasCorner.Y);
            pBezierSegment.Points.Add(pFigure.StartPoint);
            pBezierSegment.Points.Add(new Point(targetCanves.ActualWidth * 2, targetCanves.ActualHeight));
            pBezierSegment.Points.Add(new Point(targetCanves.ActualWidth, targetCanves.ActualHeight));

            // Create a MatrixTransform. This transform will be used to move the button.
            MatrixTransform matrixTransform = new MatrixTransform();
            targetCanves.RenderTransform = matrixTransform;

            pFigure.Segments.Add(pBezierSegment);
            animationPath.Figures.Add(pFigure);

            // Freeze the PathGeometry for performance benefits.
            animationPath.Freeze();

            // Create a MatrixAnimationUsingPath to move the
            // button along the path by animating its MatrixTransform.
            MatrixAnimationUsingPath matrixAnimation =
                new MatrixAnimationUsingPath();
            matrixAnimation.PathGeometry = animationPath;
            matrixAnimation.Duration = TimeSpan.FromSeconds(2 * iAnimationPutCardTime / 3);

            matrixAnimation.Completed += delegate
            {
                // the cards get reversed - there for need animation to flip it...
                DoubleAnimation doubleAnimation = new DoubleAnimation(180, 0, TimeSpan.FromSeconds(iAnimationPutCardTime / 3));
                RotateTransform rotareTransform = new RotateTransform(0, targetCanves.ActualWidth / 2, targetCanves.ActualHeight / 2);//targetCanves.ActualHeight);
                targetCanves.RenderTransform = rotareTransform;
                rotareTransform.BeginAnimation(RotateTransform.AngleProperty, doubleAnimation);
            };

            // Set the animation's DoesRotateWithTangent property
            // to true so that rotates the card in addition to moving it.
            matrixAnimation.DoesRotateWithTangent = true;
            matrixTransform.BeginAnimation(MatrixTransform.MatrixProperty, matrixAnimation);
        }
開發者ID:HarelM,項目名稱:Set-Game,代碼行數:46,代碼來源:MainWindow.xaml.cs

示例5: AnimateMoveCard

        private void AnimateMoveCard(int iLocationFrom, int iLocationTo)
        {
            Canvas canvesFrom = GetCanvas(iLocationFrom);
            Point pointCanvasCornerFrom = canvesFrom.PointToScreen(new Point(0, 0));
            Canvas canvesTo = GetCanvas(iLocationTo);
            Point pointCanvasCornerTo = canvesTo.PointToScreen(new Point(0, 0));

            // Create the animation path.
            PathGeometry animationPath = new PathGeometry();
            PathFigure pFigure = new PathFigure();

            PolyLineSegment pLineSegment = new PolyLineSegment();
            pFigure.StartPoint = new Point(0, 0);
            pLineSegment.Points.Add(pFigure.StartPoint);
            pLineSegment.Points.Add(new Point(pointCanvasCornerTo.X - pointCanvasCornerFrom.X, pointCanvasCornerTo.Y - pointCanvasCornerFrom.Y));

            // Create a MatrixTransform. This transform will be used to move the button.
            MatrixTransform matrixTransform = new MatrixTransform();

            pFigure.Segments.Add(pLineSegment);
            animationPath.Figures.Add(pFigure);

            // Freeze the PathGeometry for performance benefits.
            animationPath.Freeze();

            // Create a MatrixAnimationUsingPath to move the
            // button along the path by animating its MatrixTransform.
            MatrixAnimationUsingPath matrixAnimation = new MatrixAnimationUsingPath();
            matrixAnimation.PathGeometry = animationPath;
            matrixAnimation.Duration = TimeSpan.FromSeconds(iAnimationRemoveCardTime);

            canvesFrom.Children[0].RenderTransform = matrixTransform;
            matrixAnimation.Completed += delegate
            {
                MoveCard(iLocationFrom, iLocationTo);
            };

            matrixTransform.BeginAnimation(MatrixTransform.MatrixProperty, matrixAnimation);
        }
開發者ID:HarelM,項目名稱:Set-Game,代碼行數:39,代碼來源:MainWindow.xaml.cs


注:本文中的System.Windows.Media.MatrixTransform.BeginAnimation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。