2010-10-27 76 views

回答

1

不知道這是幹什麼用硬件的方式或沒有,但這個工程......

<Canvas> 
    <Rectangle Height="30" Width="30" Fill="Blue"> 
     <Rectangle.RenderTransform> 
      <MatrixTransform x:Name="elementMatrixTransform"> 
       <MatrixTransform.Matrix > 
        <Matrix /> 
       </MatrixTransform.Matrix> 
      </MatrixTransform> 
     </Rectangle.RenderTransform> 
     <Rectangle.Triggers> 
      <EventTrigger RoutedEvent="Rectangle.Loaded"> 
       <BeginStoryboard> 
        <Storyboard> 
         <MatrixAnimationUsingPath 
          Storyboard.TargetName="elementMatrixTransform" 
          Storyboard.TargetProperty="Matrix" 
          Duration="0:0:10" 
          RepeatBehavior="Forever"> 
          <MatrixAnimationUsingPath.PathGeometry> 
           <PathGeometry> 
            <PathFigure StartPoint="0,50"> 
             <ArcSegment Point="50,0" Size="50,50" SweepDirection="Clockwise"></ArcSegment> 
             <ArcSegment Point="100,50" Size="50,50" SweepDirection="Clockwise"></ArcSegment> 
             <ArcSegment Point="50,100" Size="50,50" SweepDirection="Clockwise"></ArcSegment> 
             <ArcSegment Point="0,50" Size="50,50" SweepDirection="Clockwise"></ArcSegment> 
            </PathFigure> 
           </PathGeometry> 
          </MatrixAnimationUsingPath.PathGeometry> 
         </MatrixAnimationUsingPath> 

        </Storyboard> 
       </BeginStoryboard> 
      </EventTrigger> 
     </Rectangle.Triggers> 
    </Rectangle> 
</Canvas>