程序是基于WPF開發的,動態創建對象和動畫。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Java編程實例、using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
java開發桌面程序。using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Animation;
namespace WpfApplication1
{
c++和java。///
/// Window1.xaml 的交互邏輯
///
public partial class Window1 : Window
{
Ellipse[] els1, els2;
整人程序代碼、Storyboard std, std2;
int theMax = 100;
public Window1()
{
InitializeComponent();
this.Title = "哈哈,看好了";
Java小程序?this.WindowState = WindowState.Maximized;
els1 = new Ellipse[theMax];
els2 = new Ellipse[theMax];
for (int n = 0; n < theMax; n++)
{
els1[n] = new Ellipse();
java項目實例?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;
java編寫。els1[n].VerticalAlignment = VerticalAlignment.Center;
//els1[n].Stretch = Stretch.Fill;
this.Root.Children.Add(els1[n]);
}
for (int s = 0; s < theMax; s++)
{
java做程序、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;
java小程序例子,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));
java web、//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);
簡單整人bat代碼。dan = new DoubleAnimation();
dan.BeginTime = TimeSpan.FromSeconds(0.02 * k);
dan.Duration = AllDuration;
dan.From = 0;
dan.To = 1000;
dan.RepeatBehavior = RepeatBehavior.Forever;
java新手代碼大全?Storyboard.SetTarget(dan, els1[k]);
Storyboard.SetTargetProperty(dan, new PropertyPath("(FrameworkElement.Height)"));
std.Children.Add(dan);
}
//2
std2 = new Storyboard();
java入門簡單小項目。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;
java入門編程、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);
java程序例子?dan = new DoubleAnimation();
dan.BeginTime = TimeSpan.FromSeconds(0.03 * e);
dan.Duration = AllDuration;
dan.From = 1350;
dan.To = 0;
dan.RepeatBehavior = RepeatBehavior.Forever;
java罵人代碼?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();
}
}
}
版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。
工作时间:8:00-18:00
客服电话
电子邮件
admin@qq.com
扫码二维码
获取最新动态