Bagikan melalui


Matrix

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Represents a 3 x 3 affine transformation matrix used for transformations in two-dimensional space.

<Matrix ... />

Managed Equivalent

Matrix

Remarks

The properties of a Matrix can be animated (as one or more DoubleAnimation or DoubleAnimationUsingKeyFrames objects).

A Matrix provides the property value for the MatrixTransform.Matrix property. Often, it is more practical to manipulate the transforms by using one of the other transform objects and properties that constrain the transform into a particular type. The transform objects are RotateTransform, ScaleTransform, SkewTransform, and TranslateTransform.

For more information on basic concepts, see Transforms. Note that the Transforms topic is written primarily for users of the managed API, and may not have code examples or specific information that address the JavaScript API scenarios.

Example

The following example transforms the position and skew of a rectangle by using a MatrixTransform object.

<Canvas
  xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
  Width="400" Height="300">
  <Rectangle Width="60" Height="60" Fill="Blue">

    <Rectangle.RenderTransform>
      <MatrixTransform>
        <MatrixTransform.Matrix >

          <!-- This matrix transforms the x,y position of
               the rectangle and skews it. -->
          <Matrix OffsetX="30" OffsetY="100" M12="0.5" />
        </MatrixTransform.Matrix>
      </MatrixTransform>
    </Rectangle.RenderTransform>

  </Rectangle>
</Canvas>

See Also

Reference