• Upgrade your Internet Experience
  • Sign in
  • Microsoft.com
  • United States (English)
    Brasil (Português)Česká republika (Čeština)Deutschland (Deutsch)España (Español)France (Français)Italia (Italiano)Россия (Русский)대한민국 (한국어)中华人民共和国 (中文)台灣 (中文)日本 (日本語)香港特别行政區 (中文)
 
 
.NET Framework Developer Center
 
 
Home
 
 
Library
 
 
Learn
 
 
Downloads
 
 
Support
 
 
Community
 
 
Forums
 
 
 
.NET Framework Developer Center > .NET Development Forums > Windows Presentation Foundation (WPF) > Animating A Polygon?
Ask a questionAsk a question
Search Forums:
  • Search Windows Presentation Foundation (WPF) Forum Search Windows Presentation Foundation (WPF) Forum
  • Search All .NET Development Forums Search All .NET Development Forums
  • Search All MSDN Forums Search All MSDN Forums
 

QuestionAnimating A Polygon?

  • Wednesday, January 17, 2007 6:47 PMmoonwalkercss Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    1

    Hi

    I have a polygon made up of a PointCollection...Is there any way to animate the points as a group?  I tried to name the points and animated them individually, but naming points is not allowed.

    • ReplyReply
    • QuoteQuote
     

All Replies

  • Wednesday, January 17, 2007 7:17 PMAnthony Hodsdon - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    1

    You can either dot down to the points using TargetPath, or convert the Polygon over to a Path containing a PathGeometry:

    <Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="
    http://schemas.microsoft.com/winfx/2006/xaml">

        <Canvas.Triggers>
          <EventTrigger RoutedEvent="Canvas.Loaded">
    <BeginStoryboard>
              <Storyboard>
                <PointAnimation
       By="-20,-20"
       Duration="0:0:2"
       RepeatBehavior="Forever"
       AutoReverse="True"
       Storyboard.TargetName="figure1"
       Storyboard.TargetProperty="StartPoint"/>
                <PointAnimation
       By="40,40"
       Duration="0:0:2"
       RepeatBehavior="Forever"
       AutoReverse="True"
       Storyboard.TargetName="segment1"
       Storyboard.TargetProperty="Point"/>
      <PointAnimation
       By="50,40"
       Duration="0:0:2"
       RepeatBehavior="Forever"
       AutoReverse="True"
       Storyboard.TargetName="segment2"
       Storyboard.TargetProperty="Point"/>
                  <PointAnimation
       By="-20,30"
       Duration="0:0:2"
       RepeatBehavior="Forever"
       AutoReverse="True"
       Storyboard.TargetName="segment3"
       Storyboard.TargetProperty="Point"/>
       
           </Storyboard>
    </BeginStoryboard>
     </EventTrigger>
        </Canvas.Triggers>

    <Path Name="path" Fill="#20000000">
      <Path.Data>
        <PathGeometry>
          <PathGeometry.Figures>
            <PathFigureCollection>
              <PathFigure x:Name="figure1" IsFilled="True" StartPoint="10, 100">
                <PathFigure.Segments>
                  <PathSegmentCollection>
                       <LineSegment x:Name="segment1" Point="20, 20" />   
                       <LineSegment x:Name="segment2" Point="90, 100" />
                       <LineSegment x:Name="segment3" Point="90, 200" />
                  </PathSegmentCollection>
                </PathFigure.Segments>
              </PathFigure>
            </PathFigureCollection>
          </PathGeometry.Figures>
        </PathGeometry>
      </Path.Data>
    </Path>
    </Canvas>

    • ReplyReply
    • QuoteQuote
     
Need Help with Forums? (FAQ)
 
© 2009 Microsoft Corporation. All rights reserved.
Terms of Use
|
Trademarks
|
Privacy Statement