WPF 动画效果
1. (Visibility)闪烁三下,停下两秒,循环:
XAML:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label Name="WarningShineLabel" Content="充电" Background="DarkRed"></Label>
</Grid>
CS
private void SetVisibilityShine()
{
ObjectAnimationUsingKeyFrames okf = new ObjectAnimationUsingKeyFrames();
okf.Duration = new TimeSpan(, , , , );
okf.RepeatBehavior = RepeatBehavior.Forever;
okf.KeyFrames.Add(new DiscreteObjectKeyFrame(Visibility.Hidden, new TimeSpan(, , )));
okf.KeyFrames.Add(new DiscreteObjectKeyFrame(Visibility.Visible, new TimeSpan(, , , , )));
okf.KeyFrames.Add(new DiscreteObjectKeyFrame(Visibility.Hidden, new TimeSpan(, , , , )));
okf.KeyFrames.Add(new DiscreteObjectKeyFrame(Visibility.Visible, new TimeSpan(, , , , )));
okf.KeyFrames.Add(new DiscreteObjectKeyFrame(Visibility.Hidden, new TimeSpan(, , , , )));
okf.KeyFrames.Add(new DiscreteObjectKeyFrame(Visibility.Visible, new TimeSpan(, , , , )));
okf.KeyFrames.Add(new DiscreteObjectKeyFrame(Visibility.Hidden, new TimeSpan(, , , , ))); WarningShineLabel.BeginAnimation(Label.VisibilityProperty, okf);
}
2. 平移:
XAML
<Label Name="AirOutAnimation">
<Label.Content>
<Image Source="../Icons/flow.png"></Image> <!--一张图片-->
</Label.Content>
</Label>
CS
ThicknessAnimation ta = new ThicknessAnimation();
ta.From = new Thickness(, , , );
ta.To = new Thickness(, , , );
ta.Duration = TimeSpan.FromSeconds(1.5);
ta.RepeatBehavior = RepeatBehavior.Forever;
AirOutAnimation.BeginAnimation(Label.MarginProperty, ta);
WPF 动画效果的更多相关文章
- wpf image控件循环显示图片 以达到动画效果 问题及解决方案
1>最初方案: 用wpf的image控件循环显示图片,达到动画效果,其实就是在后台代码动态改变Image.Source的值,关键代码: ; i < ; i++)//六百张图片 { Bitm ...
- 【WPF】两则动画效果
原文:[WPF]两则动画效果 引言 利用WPF的动画可以轻而易举的实现各种各样的特效,如擦除,滑动进入等,先看两个效果图 第一个效果 这个动画其实利用了OpacityMask和LinearGradie ...
- WPF 有趣的动画效果
WPF 有趣的动画效果 这一次我要呈上一个简单的文章,关于给你的WPF apps加入美丽的光线动画,可是我对动画这东西可能有点入迷了. 实际上.我对动画如此的入迷,以至 ...
- WPF实现左右移动(晃动)动画效果
原文:WPF实现左右移动(晃动)动画效果 实现控件或布局的左右移动(晃动)主要用到DoubleAnimation以及Storyboard 布局代码为: <Canvas> <Grid ...
- WPF 画线动画效果实现
原文:WPF 画线动画效果实现 弄了将近三天才搞定的,真是艰辛的实现. 看了很多博客,都太高深了,而且想要实现的功能都太强大了,结果基础部分一直实现不了,郁闷啊~ 千辛万苦终于找到了一个Demo,打开 ...
- WPF编游戏系列 之七 动画效果(2)
原文:WPF编游戏系列 之七 动画效果(2) 上一篇已经对关闭窗口图标进行了动画效果处理,本篇将对窗口界面的显示和关闭效果进行处理.由于所有的动画效果都是针对窗口界面的Canvas,所以 ...
- WPF编游戏系列 之六 动画效果(1)
原文:WPF编游戏系列 之六 动画效果(1) 本篇主要针对界面进行动画效果处理.首先在打开或关闭界面时,使其产生动态效果而不是生硬的显示或消失(如下图).其次在鼠标放到关闭窗口图标上时, ...
- WPF特效:流光动画效果
今天有人问我想实现一个流光效果.我简单的录了一下他想实现效果的GIF. 实际效果如下:因为今天有事情,只是大概实现了一个效果.主要使用PointAnimationUsingKeyFrames动画效果来 ...
- [WPF] 动画Completed事件里获取执行该动画的UI对象
原文:[WPF] 动画Completed事件里获取执行该动画的UI对象 昨天群里有位童鞋提出如何在动画完成事件Completed里获取到执行该动画的UI对象. WPF里动画的Completed的本身并 ...
随机推荐
- hadoop入门(2)——HDFS2.0应用场景、原理、基本架构及使用方法
一.HDFS概述 优点:高容错性.适合批处理.适合大数据处理.流式文件访问:一次写入,多次读取. 缺点:不适合低延迟数据访问.不适合小文件存取(受限于NameNode) ...
- C#基础:委托
委托是C#中最为常见的内容.与类.枚举.结构.接口一样,委托也是一种类型.类是对象的抽象,而委托则可以看成是函数的抽象.一个委托代表了具有相同参数列表和返回值的所有函数.比如: delegate in ...
- 如何转换WMV到MP3,WMV到MP3播放器
非常好的软件!!!!!没有注册,可以用.推荐给大家! http://www.daniusoft.com/cn/convert-wmv/wmv-to-mp3.html http://hi.baidu.c ...
- 一个列子演示vs2010 c++新特性
近日托安装雪豹的"福",格了XP装了win7,前段时间看了C++0X标准以及VS2010诱人的新特性,不禁心痒痒在线安装了VS2010,然后手写了这个列子用来测试新增的特性. st ...
- CodeChef COUNTARI Arithmetic Progressions(分块 + FFT)
题目 Source http://vjudge.net/problem/142058 Description Given N integers A1, A2, …. AN, Dexter wants ...
- 开源协议:LGPL协议、OSGi协议---打酱油的日子
本文介绍开源的协议. LGPL 是 GNU Lesser General Public License (GNU 宽通用公共许可证)的缩写形式,旧称 GNU Library General Publi ...
- 清华学堂 LightHouse
灯塔(LightHouse) Description As shown in the following figure, If another lighthouse is in gray area, ...
- CodeForces 515C. Drazil and Factorial
C. Drazil and Factorial time limit per test 2 seconds memory limit per test 256 megabytes input stan ...
- IIS监控指标
IIS Global Active Flushed Entries Active Flushed Entries 是缓存文件句柄,当前传输全部完成后将关闭此句柄.IIS Global 对象. Web ...
- Linux CentOS6.5下安装Oracle ASM
Oracle版本:Oracle 11g 1.确定自己的Linux版本: [root@localhost ~]#uname -r 2.6.32-431.el6.x86_64 2.6.32-431.el6 ...