Link to home
Start Free TrialLog in
Avatar of josephdaviskcrm
josephdaviskcrmFlag for United States of America

asked on

Silverlight 2 Point animation

I'm working with animation in Silverlight 2 and am able to get some stuff working, but I am having problems trying to animate a polygon object's points.  I've got a polygon with four points...

<Polygon x:Name="poly1"
                MouseLeftButtonDown="poly1_MouseLeftButtonDown"
                Points="100,100 200,100 200,200 100,200"
                Stroke="Blue"
                StrokeThickness="2">
                <Polygon.Fill>
                    <SolidColorBrush Color="LightBlue"></SolidColorBrush>
                </Polygon.Fill>
                <Polygon.RenderTransform>
                    <RotateTransform CenterX="150" CenterY="150" Angle="0" />
                </Polygon.RenderTransform>
            </Polygon>

I am trying to alter the 4 points of the polygon so that it changes into a different shape, size, and location.  In the following code, all of the animations work perfectly except for the last one that deals with the points.  I have tried to use PointAnimation instead of DoubleAnimation but it still throws an error when loading the silverlight object.

<Storyboard x:Name="myStoryBoard">
                <DoubleAnimation
                    Storyboard.TargetName="poly1"
                    Storyboard.TargetProperty="Opacity"
                    From="1.0" To="0.0" Duration="0:0:2"
                    AutoReverse="True" RepeatBehavior="Forever" />
                <ColorAnimation
                    Storyboard.TargetName="poly1"
                    Storyboard.TargetProperty="(Polygon.Fill).(SolidColorBrush.Color)"
                    From="LightBlue" To="Red" Duration="0:0:5" AutoReverse="True" RepeatBehavior="Forever" />
                <DoubleAnimation
                    Storyboard.TargetName="poly1"
                    Storyboard.TargetProperty="(Polygon.RenderTransform).(RotateTransform.Angle)"
                    From="0.0" To="90.0" Duration="0:0:5" AutoReverse="False" RepeatBehavior="Forever" />
                <DoubleAnimation
                    Storyboard.TargetName="poly1"
                    Storyboard.TargetProperty="Points"
                    From="100,100 200,100 200,200 100,200" To="100,300 200,300 300,200 300,200" Duration="0:0:5" AutoReverse="True" RepeatBehavior="Forever" />

Any ideas?
ASKER CERTIFIED SOLUTION
Avatar of adler77
adler77
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial