我正在寻找使用WPF在Microsoft PowerPoint中创建类似于“擦除”动画的动画 .
简而言之,我希望图像在1秒钟内从左向右淡入 .
这是我到目前为止的XAML,它同时淡化了所有图像:
<Window x:Class="WpfApplication2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication2"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525" Background="Purple" Loaded="Window_Loaded">
<Window.Resources>
<Storyboard x:Key="fade">
<DoubleAnimation From="0" To="1" Duration="0:0:1"
Storyboard.TargetName="logo"
Storyboard.TargetProperty="Opacity"/>
</Storyboard>
</Window.Resources>
<Grid>
<Image Source="image.png" x:Name="logo"/>
</Grid>
</Window>
在后面的代码中,我只是在窗口加载时播放动画:
private void Window_Loaded(object sender, RoutedEventArgs e)
{
BeginStoryboard((Storyboard)FindResource("fade"));
}
我需要添加到Storyboard标签以使图像淡入淡出类似于PowerPoint上的擦除动画?
1 回答
从this博客文章中找到答案 . 我需要实现我需要的效果的代码与帖子中的代码相同,但我不需要第一个图像 . (UFO.jpg)