首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > CAD教程 >

Path 怎么动画颜色填充呢

2012-07-02 
Path 如何动画颜色填充呢?Path制作的不规则图形,有没有动画填充的方法呢?例如:三角形,能够从每一个定点填

Path 如何动画颜色填充呢?
Path制作的不规则图形,有没有动画填充的方法呢?

例如:三角形,能够从每一个定点填色,最后到边上的动画方式

谢谢!

[解决办法]
给你写个WPF例子,用Blend很好做的

XML code
<Window x:Class="WpfApplication2.MainWindow"        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"        Title="MainWindow" Height="350" Width="525">    <Window.Resources>        <Storyboard x:Key="Storyboard1">            <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="path">                <EasingColorKeyFrame KeyTime="0" Value="Red"/>            </ColorAnimationUsingKeyFrames>            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(Brush.RelativeTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="path">                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>                <EasingDoubleKeyFrame KeyTime="0:0:2" Value="135"/>            </DoubleAnimationUsingKeyFrames>        </Storyboard>    </Window.Resources>    <Window.Triggers>        <EventTrigger RoutedEvent="FrameworkElement.Loaded">            <BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>        </EventTrigger>    </Window.Triggers>    <Grid>        <Path x:Name="path" Data="M1,0L2,2 0,2z" Margin="50.167,51.333,0,0" Stretch="Fill" Stroke="Black" HorizontalAlignment="Left" Width="123.333" Height="102.833" VerticalAlignment="Top">            <Path.Fill>                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">                    <LinearGradientBrush.RelativeTransform>                        <TransformGroup>                            <ScaleTransform CenterY="0.5" CenterX="0.5"/>                            <SkewTransform CenterY="0.5" CenterX="0.5"/>                            <RotateTransform CenterY="0.5" CenterX="0.5"/>                            <TranslateTransform/>                        </TransformGroup>                    </LinearGradientBrush.RelativeTransform>                    <GradientStop Color="Black" Offset="0"/>                    <GradientStop Color="White" Offset="1"/>                </LinearGradientBrush>            </Path.Fill>        </Path>    </Grid></Window> 

热点排行