码迷,mamicode.com
首页 > Windows程序 > 详细

WPF圆动画旋转、边框、内容渲染

时间:2017-06-07 17:31:22      阅读:327      评论:0      收藏:0      [点我收藏+]

标签:art   begin   origin   ntb   cti   ever   sha   die   end   

    <Grid>
        <Viewbox Margin="20">

            <Ellipse x:Name="ellipse1" Width="150" Height="150" StrokeThickness="10" RenderTransformOrigin="0.5,0.5">
                <Ellipse.Effect>
                    <DropShadowEffect ShadowDepth="0" BlurRadius="50" Color="Blue" />
                </Ellipse.Effect>
                <Ellipse.RenderTransform>
                    <RotateTransform x:Name="rotate1" Angle="0" />
                </Ellipse.RenderTransform>
                <Ellipse.Triggers>
                    <EventTrigger RoutedEvent="Loaded" SourceName="ellipse1">
                        <EventTrigger.Actions>
                            <BeginStoryboard>
                                <Storyboard RepeatBehavior="Forever">
                                    <!--Fill-->
                                    <DoubleAnimation Storyboard.TargetName="gs31" Storyboard.TargetProperty="Offset" From="0" To="0.7" Duration="0:0:5" BeginTime="00:00:00.1" />
                                    <DoubleAnimation Storyboard.TargetName="gs32" Storyboard.TargetProperty="Offset" From="0" To="0.7" Duration="0:0:5" BeginTime="00:00:00.1" />
                                    <DoubleAnimation Storyboard.TargetName="gs41" Storyboard.TargetProperty="Offset" From="0" To="0.7" Duration="0:0:5" BeginTime="00:00:0" />
                                    <DoubleAnimation Storyboard.TargetName="gs42" Storyboard.TargetProperty="Offset" From="0" To="0.7" Duration="0:0:5" BeginTime="00:00:0"  />
                                    <DoubleAnimation Storyboard.TargetName="gs31" Storyboard.TargetProperty="Offset" From="0.7" To="1" Duration="0:0:5" BeginTime="00:00:06" />
                                    <DoubleAnimation Storyboard.TargetName="gs32" Storyboard.TargetProperty="Offset" From="0.7" To="1" Duration="0:0:5" BeginTime="00:00:06" />
                                    <DoubleAnimation Storyboard.TargetName="gs41" Storyboard.TargetProperty="Offset" From="0.7" To="1" Duration="0:0:5" BeginTime="00:00:5" />
                                    <DoubleAnimation Storyboard.TargetName="gs42" Storyboard.TargetProperty="Offset" From="0.7" To="1" Duration="0:0:5" BeginTime="00:00:5"  />
                                    <!--Stroke-->
                                    <DoubleAnimation Storyboard.TargetName="gs51" Storyboard.TargetProperty="Offset" From="0" To="0.7" Duration="0:0:5" BeginTime="00:00:00.1" />
                                    <DoubleAnimation Storyboard.TargetName="gs52" Storyboard.TargetProperty="Offset" From="0" To="0.7" Duration="0:0:5" BeginTime="00:00:00.1" />
                                    <DoubleAnimation Storyboard.TargetName="gs61" Storyboard.TargetProperty="Offset" From="0" To="0.7" Duration="0:0:5" BeginTime="00:00:0" />
                                    <DoubleAnimation Storyboard.TargetName="gs62" Storyboard.TargetProperty="Offset" From="0" To="0.7" Duration="0:0:5" BeginTime="00:00:0"  />
                                    <DoubleAnimation Storyboard.TargetName="gs51" Storyboard.TargetProperty="Offset" From="0.7" To="1" Duration="0:0:5" BeginTime="00:00:06" />
                                    <DoubleAnimation Storyboard.TargetName="gs52" Storyboard.TargetProperty="Offset" From="0.7" To="1" Duration="0:0:5" BeginTime="00:00:06" />
                                    <DoubleAnimation Storyboard.TargetName="gs61" Storyboard.TargetProperty="Offset" From="0.7" To="1" Duration="0:0:5" BeginTime="00:00:5" />
                                    <DoubleAnimation Storyboard.TargetName="gs62" Storyboard.TargetProperty="Offset" From="0.7" To="1" Duration="0:0:5" BeginTime="00:00:5"  />
                                    <!--Rotate-->
                                    <DoubleAnimation Storyboard.TargetName="rotate1" Storyboard.TargetProperty="Angle" From="0" To="360" Duration="0:0:10" />
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger.Actions>
                    </EventTrigger>
                </Ellipse.Triggers>
                <Ellipse.Stroke>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                        <GradientStop Offset="0" Color="Blue" />
                        <GradientStop x:Name="gs51" Offset="0" Color="Blue" />
                        <GradientStop x:Name="gs52" Offset="0" Color="Aqua" />
                        <GradientStop x:Name="gs61" Offset="0" Color="Aqua" />
                        <GradientStop x:Name="gs62" Offset="0" Color="Blue" />
                        <GradientStop Offset="1" Color="Blue" />
                    </LinearGradientBrush>
                </Ellipse.Stroke>
                <Ellipse.Fill>
                    <RadialGradientBrush>
                        <GradientStop Offset="0" Color="Blue" />
                        <GradientStop x:Name="gs31" Offset="0" Color="Blue" />
                        <GradientStop x:Name="gs32" Offset="0" Color="Aqua" />
                        <GradientStop x:Name="gs41" Offset="0" Color="Aqua" />
                        <GradientStop x:Name="gs42" Offset="0" Color="Blue" />
                        <GradientStop Offset="1" Color="Blue" />
                    </RadialGradientBrush>
                </Ellipse.Fill>
            </Ellipse>
        </Viewbox>
    </Grid>

 

WPF圆动画旋转、边框、内容渲染

标签:art   begin   origin   ntb   cti   ever   sha   die   end   

原文地址:http://www.cnblogs.com/RedSky/p/6958074.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!