How to make a image swivel in wpf?

2019-08-30 09:01发布

问题:

I was looking at this post.

I was wondering if it was possible to make a image swivel in wpf?

If not, how would i change the solution to make my WPF image swivel repeatedly?

回答1:

I found this simple solution:

This is all you need.

<pl:Planerator Name="planerator">
        <Image Name="logo"
           Source="somePath" >
            <Image.Triggers>
                <EventTrigger RoutedEvent="Image.Loaded">
                    <BeginStoryboard>
                        <Storyboard TargetProperty="ScaleX" RepeatBehavior="Forever">
                            <DoubleAnimation Storyboard.TargetName="planerator" 
                                             Storyboard.TargetProperty="RotationY"
                                             From="0" To="360"
                                             BeginTime="0:0:0"
                                             Duration="0:0:5"  
                                             AutoReverse="False"/>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Image.Triggers>
        </Image>
    </pl:Planerator>