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.Forms;
namespace 图形转换矩阵特效
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
Timer timer = new Timer();//system.windows.forms中的timer
private void button1_Click(object sender, RoutedEventArgs e)
{
timer.Interval = 1000;//每一秒钟执行一次
timer.Tick += new EventHandler(timer_Tick);
timer.Enabled = true;//启动计时器
}
double angle = 0d;
double scaX = 1d;
double scaY = 1d;
void timer_Tick(object sender, EventArgs e)
{
RotateTransform rt = new RotateTransform();
rt.Angle = angle;
ScaleTransform st = new ScaleTransform();
st.ScaleX = scaX;
st.ScaleY = scaY;
angle += 10d;//每秒钟旋转10°
scaX += 0.5;//每秒钟X方向放大0.5倍
scaY += 1;//每秒钟Y方向放大1倍
TransformGroup tg = new TransformGroup();
tg.Children.Add(rt);
tg.Children.Add(st);
rectangle1.RenderTransform = tg;
}
}
}
图形转换矩阵特效
图形转换矩阵(Transform)特效的使用
最新推荐文章于 2020-04-16 19:45:13 发布