WPF-利用Blend写的平面控制闸门开关动画

本文介绍了如何使用Blend为WPF创建一个平面控制闸门开关的动画效果,通过XAML代码实现。虽然没有展示3D效果,但提到了实现3D效果需要导入3D模型并调整相机视角。
摘要由CSDN通过智能技术生成

Blend写的WPF控制闸门开关的动画,这个是平面效果,如果需要3D效果的话需要导入3D模型,然后在Blend中控制相机走位来控制闸门和水位的变化。

效果图:






xaml代码:

<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	x:Class="wpf天狗食月动画.闸门控制"
	x:Name="Window"
	Title="闸门控制"
	Width="640" Height="480">
	<Window.Resources>
		<Storyboard x:Key="Storyboard1" AutoReverse="True" RepeatBehavior="Forever">
			<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="LayoutRoot">
				<EasingColorKeyFrame KeyTime="0:0:2" Value="#FFE8EBF0"/>
				<EasingColorKeyFrame KeyTime="0:0:3" Value="#FFE8EBF0"/>
			</ColorAnimationUsingKeyFrames>
			<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="rectangle">
				<EasingColorKeyFrame KeyTime="0:0:2" Value="#FF009DFF"/>
			</ColorAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="rectangle">
				<EasingDoubleKeyFrame KeyTime="0:0:2" Value="0.25"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="rectangle">
				<EasingDoubleKeyFrame KeyTime="0:0:2" Value="0.581"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="rectangle">
				<EasingDoubleKeyFrame KeyTime="0:0:2" Value="0.921"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="rectangle">
				<EasingDoubleKeyFrame KeyTime="0:0:2" Value="-3.398"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="rectangle">
				<EasingDoubleKeyFrame KeyTime="0:0:2" Value="56.071"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="rectangle1">
				<EasingDoubleKeyFrame KeyTime="0:0:2" Value="-20.389"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="rectangle1">
				<EasingDoubleKeyFrame KeyTime="0:0:2" Value="50.974"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="rectangle1_Copy">
				<EasingDoubleKeyFrame KeyTime="0:0:2" Value="258.266"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="rectangle1_Copy">
				<EasingDoubleKeyFrame KeyTime="0:0:2" Value="51.823"/>
			</DoubleAnimationUsingKeyFrames>
			<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="rectangle1">
				<EasingColorKeyFrame KeyTime="0:0:2" Value="#FFBBBBC2"/>
			</ColorAnimationUsingKeyFrames>
			<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="rectangle1_Copy">
				<EasingColorKeyFrame KeyTime="0:0:2" Value="#FFBBBBC2"/>
			</ColorAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="rectangle2">
				<EasingDoubleKeyFrame KeyTime="0:0:2" Value="-20.389"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="rectangle2_Copy">
				<EasingDoubleKeyFrame KeyTime="0:0:2"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值