资源简介
平时工作积累的资源。代码经过封装,使用方便,包含多种动画。
类名:AirBubblesAnimation
效果:气泡动画
说明:类似于气泡的弹出动画(根据运用场景设置元素向下对齐,能看出气泡自下向上弹出),弹出之后有来回的缓动效果。
类名:ShuttersAnimation
效果:百叶窗动画
说明:类似于百叶窗的展现动画(一般用于图片、视频效果)。可通过设置矩形宽度和百叶窗方向,来实现不同的展示效果。
类名:OpacityFadingAnimation
效果:淡入淡出动画
说明:通过控制元素的透明度,实现元素的淡入淡出动画效果。
类名:InsideOutFadingAnimation
效果:扩散动画
说明:通过控制元素透明掩码,实现元素由中心向外渐显的动画,以及由外向中心渐隐的动画。
类名:LinearFadingAnimation
效果:线性动画
说明:通过控制元素透明掩码,实现元素自下向上的渐显动画,以及自上向下的渐隐动画。
类名:AirBubblesAnimation
效果:气泡动画
说明:类似于气泡的弹出动画(根据运用场景设置元素向下对齐,能看出气泡自下向上弹出),弹出之后有来回的缓动效果。
类名:ShuttersAnimation
效果:百叶窗动画
说明:类似于百叶窗的展现动画(一般用于图片、视频效果)。可通过设置矩形宽度和百叶窗方向,来实现不同的展示效果。
类名:OpacityFadingAnimation
效果:淡入淡出动画
说明:通过控制元素的透明度,实现元素的淡入淡出动画效果。
类名:InsideOutFadingAnimation
效果:扩散动画
说明:通过控制元素透明掩码,实现元素由中心向外渐显的动画,以及由外向中心渐隐的动画。
类名:LinearFadingAnimation
效果:线性动画
说明:通过控制元素透明掩码,实现元素自下向上的渐显动画,以及自上向下的渐隐动画。

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace System.Windows.Media.Animation {
///
/// 气泡动画
///
public class AirBubblesAnimation {
#region 私有字段
//动画元素
private frameworkElement element;
//显示故事版
private Storyboard showStoryboard;
//隐藏故事版
private Storyboard hideStoryboard;
#endregion
#region 公共属性
///
/// 显示动画结束事件
///
public event EventHandler ShowAnimationCompleted;
///
/// 隐藏动画结束事件
///
public event EventHandler HideAnimationCompleted;
///
/// 显示元素大小
///
public Size ElementSize { get; set; }
#endregion
#region 公共方法
///
/// 气泡动画实例
///
/// 动画元素
public AirBubblesAnimation(frameworkElement element) {
this.element = element;
//显示动画
var showWidthAnimation = new DoubleAnimation(0 this.ElementSize.Width new Duration(TimeSpan.FromSeconds(1.5))) {
EasingFunction = new ElasticEase() { EasingMode = EasingMode.EaseOut Oscillations = 8 Springiness = 18 }
};
var showHeightAnimation = new DoubleAnimation(0 this.ElementSize.Height new Duration(TimeSpan.FromSeconds(1.5))) {
EasingFunction = new ElasticEase() { EasingMode = EasingMode.EaseOut Oscillations = 8 Springiness = 18 }
};
this.showStoryboard = new Storyboard() { Children = new TimelineCollection() { showWidthAnimation showHeightAnimation } };
this.showStoryboard.Completed += showStoryboard_Completed;
Storyboard.SetTarget(showWidthAnimation this.element);
Storyboard.SetTarget(showHeightAnimation this.element);
Storyboard.SetTargetProperty(showWidthAnimation new PropertyPath(frameworkElement.WidthProperty));
Storyboard.SetTargetProperty(showHeightAnimation new PropertyPath(frameworkElement.HeightProperty));
//隐藏动画
var hideWidthAnimation = new DoubleAnimation(this.ElementSize.Width 0 new Duration(TimeSpan.FromSeconds(0.5))) {
EasingFunction = new ElasticEase() { EasingMode = EasingMode.EaseIn Oscillations = 2 Springiness = 15 }
};
var hideHeightAnimation = new DoubleAnimation(this.ElementSize.Height 0 new Duration(TimeSpan.FromSeconds(0.5))) {
EasingFunction = new ElasticEase() { EasingMode = EasingMode.EaseIn Oscillations = 2 Springiness = 15 }
};
this.hideStoryboard = new Storyboard() { Children = new TimelineCollection() { hideWidthAnimation hideHeightAnimation } };
this.hideStoryboard.Completed += hideStoryboard_Compl
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-07-19 13:59 WPF动画类\
目录 0 2018-07-19 13:58 WPF动画类\Animation\
文件 5614 2018-07-19 13:53 WPF动画类\Animation\AirBubblesAnimation.cs
文件 4639 2018-07-19 13:53 WPF动画类\Animation\InsideOutFadingAnimation.cs
文件 6933 2018-07-19 13:53 WPF动画类\Animation\LinearFadingAnimation.cs
文件 3261 2018-07-19 13:53 WPF动画类\Animation\OpacityFadingAnimation.cs
文件 5538 2018-07-19 13:53 WPF动画类\Animation\ShuttersAnimation.cs
文件 963 2018-07-19 10:55 WPF动画类\Animation\动画使用类说明.txt
相关资源
- C#解析HL7消息的库135797
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
评论
共有 条评论