MatrixTransform in Storyboard/Animation

Unanswered MatrixTransform in Storyboard/Animation

  • Thursday, April 26, 2012 10:11 AM
     
      Has Code

    I'm doing a MatrixTransform on an object based on the ManipulationDelta. However, it's not going smooth. So what I want to do is putting it in a very short Storyboard/Animation from codebehind to create a smooth effect.

    Problem is : I don't have experience with MatrixTransform or with Storyboards in C# Can someone help me please.

    public static void ManipulationDelta(ManipulationDeltaEventArgs e)
    {
                    var element = e.OriginalSource as UIElement;
                    var transformation = element.RenderTransform as MatrixTransform;
                    var matrix = transformation == null ? 
                         Matrix.Identity : transformation.Matrix;  
    
                  matrix.ScaleAt(e.DeltaManipulation.Scale.X,
                                    e.DeltaManipulation.Scale.Y, e.ManipulationOrigin.X, e.ManipulationOrigin.Y);
                matrix.Translate(e.DeltaManipulation.Translation.X, e.DeltaManipulation.Translation.Y);
                    matrix.RotateAt(e.DeltaManipulation.Rotation,                   e.ManipulationOrigin.X,  e.ManipulationOrigin.Y);  
                      element.RenderTransform = new MatrixTransform(matrix);    }


All Replies

  • Monday, April 30, 2012 7:46 AM
    Moderator
     
     

    Hi HellScreamm,

    Welcome to the MSDN forum.

    Can you tell us what kind of application are you developing please? (winform,WPF,silverlight...)


    Bob Shen [MSFT]
    MSDN Community Support | Feedback to us

  • Thursday, July 12, 2012 10:21 PM
     
     

    Hello, I'm in a similar problem. I need to create an animation of translation from a Transform Matrix and not from a Translate Transform. Jobs in WPF.