zoukankan
html css js c++ java
写了一个整人程序,较简单,有兴趣者可以看看
程序是基于WPF开发的,动态创建对象和动画。
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Windows.Media.Animation; namespace WpfApplication1 { /// <summary> /// Window1.xaml 的交互逻辑 /// </summary> public partial class Window1 : Window { Ellipse[] els1, els2; Storyboard std, std2; int theMax = 100; public Window1() { InitializeComponent(); this.Title = "哈哈,看好了"; this.WindowState = WindowState.Maximized; els1 = new Ellipse[theMax]; els2 = new Ellipse[theMax]; for (int n = 0; n < theMax; n++) { els1[n] = new Ellipse(); els1[n].Fill = Brushes.Transparent; els1[n].Stroke = Brushes.Black; els1[n].StrokeThickness = 0.55; els1[n].Width = 0; els1[n].Height = 0; els1[n].HorizontalAlignment = HorizontalAlignment.Center; els1[n].VerticalAlignment = VerticalAlignment.Center; //els1[n].Stretch = Stretch.Fill; this.Root.Children.Add(els1[n]); } for (int s = 0; s < theMax; s++) { els2[s] = new Ellipse(); els2[s].Fill = Brushes.Transparent; els2[s].Stroke = Brushes.Black; els2[s].StrokeThickness = 0.45; //els2[s].Width = 1300; //els2[s].Height = 970; els2[s].Margin = new Thickness(-150); this.Root.Children.Add(els2[s]); } std = new Storyboard(); std.RepeatBehavior = RepeatBehavior.Forever; Duration AllDuration = new Duration(TimeSpan.FromSeconds(1.2)); //std.Duration = AllDuration; for (int k = 0; k < theMax; k++) { DoubleAnimation dan = new DoubleAnimation(); dan.BeginTime = TimeSpan.FromSeconds(0.02 * k); dan.Duration = AllDuration; dan.From = 0; dan.To = 1100; dan.RepeatBehavior = RepeatBehavior.Forever; Storyboard.SetTarget(dan, els1[k]); Storyboard.SetTargetProperty(dan, new PropertyPath("(FrameworkElement.Width)")); std.Children.Add(dan); dan = new DoubleAnimation(); dan.BeginTime = TimeSpan.FromSeconds(0.02 * k); dan.Duration = AllDuration; dan.From = 0; dan.To = 1000; dan.RepeatBehavior = RepeatBehavior.Forever; Storyboard.SetTarget(dan, els1[k]); Storyboard.SetTargetProperty(dan, new PropertyPath("(FrameworkElement.Height)")); std.Children.Add(dan); } //2 std2 = new Storyboard(); std2.RepeatBehavior = RepeatBehavior.Forever; for (int e = 0; e < theMax; e++) { DoubleAnimation dan = new DoubleAnimation(); dan.BeginTime = TimeSpan.FromSeconds(0.05 * e); dan.Duration = AllDuration; dan.From = 1100; dan.To = 0; dan.RepeatBehavior = RepeatBehavior.Forever; Storyboard.SetTarget(dan, els2[e]); Storyboard.SetTargetProperty(dan, new PropertyPath("(FrameworkElement.Width)")); std2.Children.Add(dan); dan = new DoubleAnimation(); dan.BeginTime = TimeSpan.FromSeconds(0.03 * e); dan.Duration = AllDuration; dan.From = 1350; dan.To = 0; dan.RepeatBehavior = RepeatBehavior.Forever; Storyboard.SetTarget(dan, els2[e]); Storyboard.SetTargetProperty(dan, new PropertyPath("(FrameworkElement.Height)")); std2.Children.Add(dan); } this.Loaded += new RoutedEventHandler(Window1_Loaded); } void Window1_Loaded(object sender, RoutedEventArgs e) { MessageBox.Show("\n\n注意啊,别把眼睛靠得太近!!\n\n\n"); std.Begin(); std2.Begin(); } } }
查看全文
相关阅读:
CF 990A. Commentary Boxes【数学/模拟】
HDU 变形课 1181【DFS/BFS】
HDU 1180 诡异的楼梯【BFS/楼梯随时间变化】
牛客网 小白赛4 A三角形【贪心】
POJ 2251 Dungeon Master【三维BFS模板】
Poj 1236 Network of Schools (Tarjan)
Poj 2186 Popular Cows (Tarjan)
Hdu 5285 wyh2000 and pupil (bfs染色判断奇环) (二分图匹配)
搜索专题题解
Light 1289
原文地址:https://www.cnblogs.com/javawebsoa/p/2457966.html
最新文章
switch,break和default语句练习
CodeVS 1226 倒水问题【DFS/BFS】
POJ 3087 Shuffle'm Up【模拟/map/string】
POJ 3126 Prime Path【从一个素数变为另一个素数的最少步数/BFS】
POJ 1008 Maya Calendar / UVA 300【日期转换/常量数组】
HDU 6081 度度熊的王国战略【并查集/数据弱水题/正解最小割算法】
HDU 5969 最大的位或【贪心/按位或/思维】
0103 最短Hamilton路径【状压DP】
快速乘模板
快速幂模板
热门文章
CF 996B World Cup 【找规律/模拟】
最大子段和模板
CF 999B. Reversing Encryption【模拟/string reverse】
CF A.Mishka and Contest【双指针/模拟】
CF 612C. Replace To Make Regular Bracket Sequence【括号匹配】
计蒜客 括号匹配
括号匹配算法思想
CF 917A The Monster 【括号匹配】
CF 990C. Bracket Sequences Concatenation Problem【栈/括号匹配】
CF 990B. Micro-World【数组操作/贪心/STL/二分搜索】
Copyright © 2011-2022 走看看