WPF 图片跑马灯

 1 public void OnFlushImage()
 2 {
 3     bool bStart = false;
 4     while (mFlush == true)
 5     {
 6         if (bStart)
 7         {
 8             Thread.Sleep(1000);
 9             continue;
10         }
11
12         bStart = true;
13
14         cloudTop.Dispatcher.BeginInvoke(
15         new Action(() =>
16         {
17             Duration duration = new Duration(TimeSpan.FromMilliseconds(20000));
18             DoubleAnimation daRx = new DoubleAnimation();
19             daRx.Duration = duration;
20             daRx.To = 1300;
21             daRx.RepeatBehavior = RepeatBehavior.Forever;
22
23             cloudTop_tt.BeginAnimation(TranslateTransform.XProperty, daRx);
24         }), null);
25
26         Thread.Sleep(3000);
27
28         cloudBottom.Dispatcher.BeginInvoke(
29         new Action(() =>
30         {
31             Duration duration = new Duration(TimeSpan.FromMilliseconds(10000));
32             DoubleAnimation daRx = new DoubleAnimation();
33             daRx.Duration = duration;
34             daRx.To = 1300;
35             daRx.RepeatBehavior = RepeatBehavior.Forever;
36
37             cloudBottom_tt.BeginAnimation(TranslateTransform.XProperty, daRx);
38         }), null);
39     }
40
41     // Stop
42     cloudTop.Dispatcher.BeginInvoke(
43         new Action(() =>
44         {
45             Duration duration = new Duration(TimeSpan.FromMilliseconds(400));
46             DoubleAnimation daRx = new DoubleAnimation();
47             daRx.Duration = duration;
48             daRx.To = 1300;
49
50             cloudTop_tt.BeginAnimation(TranslateTransform.XProperty, daRx);
51         }), null);
52
53     cloudBottom.Dispatcher.BeginInvoke(
54     new Action(() =>
55     {
56         Duration duration = new Duration(TimeSpan.FromMilliseconds(400));
57         DoubleAnimation daRx = new DoubleAnimation();
58         daRx.Duration = duration;
59         daRx.To = 1300;
60
61         cloudBottom_tt.BeginAnimation(TranslateTransform.XProperty, daRx);
62     }), null);
63
64     Thread.Sleep(1000);
65
66     // Origin
67     cloudTop.Dispatcher.BeginInvoke(
68         new Action(() =>
69         {
70             Duration duration = new Duration(TimeSpan.FromMilliseconds(10));
71             DoubleAnimation daRx = new DoubleAnimation();
72             daRx.Duration = duration;
73             daRx.To = 0;
74
75             cloudTop_tt.BeginAnimation(TranslateTransform.XProperty, daRx);
76         }), null);
77
78     cloudBottom.Dispatcher.BeginInvoke(
79     new Action(() =>
80     {
81         Duration duration = new Duration(TimeSpan.FromMilliseconds(10));
82         DoubleAnimation daRx = new DoubleAnimation();
83         daRx.Duration = duration;
84         daRx.To = 0;
85
86         cloudBottom_tt.BeginAnimation(TranslateTransform.XProperty, daRx);
87     }), null);
88
89     System.Diagnostics.Trace.WriteLine("Flush thread end.");
90 }
时间: 2024-08-29 03:38:23

WPF 图片跑马灯的相关文章

jCarousel Lite 实现图片跑马灯效果

官方网站:http://www.gmarwaha.com/jquery/jcarousellite/ demo: <!DOCTYPE> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="http://libs.baidu.com/jquery/1.9.0/jquer

js图片跑马灯效果

<style. type="text/css">body{margin:0px auto; padding:0px;}ul,li{margin:0px; padding:0px;list-style.:none;}.sqBorder {width:122px; height:182px; padding:10px; border:1px #000000 solid; background:#555555;}.scroll_div {width:122px; height:1

跑马灯小效果

今天在项目中需要一个图片跑马灯的效果 , 就用js写了一个 直接上代码吧: css代码: *{margin:0;padding:0;} .clearfix:after { content: ""; display: table; clear: both; } .clearfix: { *zoom: 1; } #div1{ width:1200px;height:200px;margin:100px auto;position:relative;background:red; overf

【HTML】 向网页&lt;Title&gt;&lt;/Title&gt;中插入图片以及跑马灯

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <style type="text/css"> </style> <title> 欢迎来到我的主页界面</title> <!--引入图片--> <link href="images/titleIcon.ico" rel="

android ViewPager实现 跑马灯切换图片+多种切换动画

近期在弄个项目.要求有跑马灯效果的图片展示. 网上搜了一堆,都没有完美实现的算了还是自己写吧! 实现原理利用 ViewPager 控件,这个控件本身就支持滑动翻页非常好非常强大好多功能都能用上它.利用mViewPager.setCurrentItem(currentIndex); 来实现切换当前显示的view 在加一个定时器不断设置setCurrentItem 来实现跑马灯效果. 一.主要实现类 凝视非常具体了 一看就知道了 package com.example.marqueeimage; i

WPF 简易的跑马灯效果

最近项目上要用到跑马灯的效果,和网上不太相同的是,网上大部分都是连续的,而我们要求的是不连续的. 也就是是,界面上就展示4项(展示项数可变),如果有7项要展示的话,则不断的在4个空格里左跳,当然,衔接上效果不是很好看. 然后,需要支持点击以后进行移除掉不再显示的内容. 效果如下: 思路大致如下: 1.最外层用一个ViewBox,为了可以填充调用此控件的地方,这样可以方便自动拉伸 <Viewbox x:Name="viewbox_main" Height="{Bindin

跑马灯抽奖,本地图片简单实现

公司要做个抽奖功能,写了两个demo,这个是使用本地图片的跑马灯抽奖.加载的本地图片,这种的比较简单.想“跑”起来原理也很简单.      一个是控制好线程sleep时间,sleep时做图片的变换,变换指的就是用滚动的图片依次替换下一个图片.      再一个就是图片的定位,这个根据当前图片位置就可以精确计算了,比用WheelView做的老\虎\机容易定位.      我还添加了SoundPool 让每次变动都有一个声音,这样更像游戏. 注意额:跑马灯还可以做成网络图片版本,稍微复杂一点,处理好

html入门(转义字符、行内样式和块级元素、定位、锚点、跑马灯标签、图片标签、表格标签的讲解)

一.转义字符由特殊字符包裹的文本 会当做标签去解析 对应不换行空格 对应全角空格 em是字体排印学的计量单位,相当于当前指定的点数.其占据的宽度正好是1个中文宽度,而且基本上不受字体影响.<对应< >对应> 二.行内元素和块级元素1.块级标签默认情况下,每一个块级元素都是独占一行的即元素的前后都会换行 都有 align 属性,例如: p标签 段落标签 h1~6标签 标题标签 hr标签   水平分割线标签 div标签 块级元素 2.行内标签 不会换行可以和其他的标签或文本在一行内显示

Third Day:正式编程第三天,学习实践内容TextView跑马灯、AutoCompleteTextView、multiAutoCompleteTextView以及ToggleButton、checkedBox、RadioButton等相关实践

2.针对Focused的TextView跑马灯(文字较多一行无法显示)效果 针对单个TextView的跑马灯效果,可直接在TextView控件参数中添加三个属性: android:singleLine="true"(一行显示会有省略号) android:ellipsize="marquee"(一行显示无省略号) android:focusable="true" android:focusableInTouchMode="true&quo