ToB企服应用市场:ToB评测及商务社交产业平台
标题:
C# GDI+ 画心形 跳动动画
[打印本页]
作者:
一给
时间:
2022-11-10 00:44
标题:
C# GDI+ 画心形 跳动动画
最近听说什么国产神剧的期中考试画心形题很火,打算跟风用C#复刻一下
先看看效果:
话不多说直接上代码
public Form1()
{
DoubleBuffered = true; //首先窗体记得设置双缓冲
SetStyle(ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
InitializeComponent();
}
复制代码
[code] /// /// 是否反向 /// private bool goBack = false; /// /// 当前跳动动画缩放倍率 /// private int iZoom = 10; /// /// 跳动速度 /// private int Speed { get; set; } = 8; /// /// 绘制笔刷颜色 /// private Brush Color { get; set; } = Brushes.LightPink; /// /// 中心缩放倍率 /// private int Zoom { get; set; } = 10; /// /// 点数量(包括心形边线和粒子) /// private int Particle { get; set; } = 20; /// /// 一次扩散范围 /// private int FirstDiffusion { get; set; } = 10; /// /// 二次扩散范围 /// private int SecondDiffusion { get; set; } = 30; protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); iZoom += goBack ? -1 : 1; if (iZoom >= (Zoom + 2) || iZoom
欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/)
Powered by Discuz! X3.4