当前位置:网站首页>#夏日挑战赛#【FFH】这个盛夏,来一场“清凉”的代码雨!
#夏日挑战赛#【FFH】这个盛夏,来一场“清凉”的代码雨!
2022-07-25 18:37:00 【51CTO】
这个夏天真的是太热了,来一场盛大的代码雨吧!
以dayu200为例,过程非常简单!
0. 效果

1. 代码实现
1.1 创建Canvas画布
- 创建一个覆盖全屏的画布,code_rain, 代码雨画布。
- 背景设置成黑色。
1.2 定义变量
这里我们定义如下几个变量:
| 变量 | 意义 |
|---|---|
| code_rain | 画布对象 |
| rain_y | 每滴代码雨的y坐标 |
| columns | 每行有多少滴雨 |
| font_size | 雨有多大 |
| context | 上下文对象 |
初始化
具体解析看代码注释即可。
1.3 开画
具体流程看注释,窗口大小根据实际情况修改参数,效果也是。
1.4 效果
2. 加点颜色
我们可以添加一些颜色数组来动态变化数字雨的颜色,比如这里选择了一套赛博朋克的经典配色。
那么,把刚刚的"green"换成随机颜色就好了。
2.1 效果

3. 结语
热。
边栏推荐
猜你喜欢

Interview shock: why does TCP need three handshakes?

win11下vscode 自动升级失败 There was an error while marking a file for deletion

7. Dependency injection

什么是3DE体验平台

Related operations of binary tree

Safe operation instructions for oscilloscope probe that must be read by engineers

华为年内二度招聘“天才少年”;540万Twitter账号信息泄露,卖价3万美元;谷歌解雇了相信AI有意识的工程师|极客头条

SQL things

软件测试——常用的测试工具

数二2010真题考点
随机推荐
Software testing -- common testing tools
想要做好软件测试,可以先了解AST、SCA和渗透测试
How to add EXE file to boot
Compilation of program
Introduction notes of JVM foundation and problem analysis
The milestone progress has been made in the joint development of whole human GPCR antibody drugs by baicalto and liberothera
大厂云业务调整,新一轮战争转向
Tang's little helper
Disk performance and capacity
Combined with GHS multi, use Reza E1 simulator to realize the simulation and debugging of Reza rh850 single chip microcomputer
Insufficient space on Disk C mklink solves vscode expansion migration to other disks
软件测试——常用的测试工具
Practice of RTC performance automation tool in memory optimization scenario
Nc78 reverse linked list
这是一张机器&深度学习代码速查表
Repair process of bad blocks of primary standby database
【翻译】LFX 2022年春季导师资格开放--2月13日前申请CNCF项目!
[QNX Hypervisor 2.2用户手册]9.5 dump
Trust multithread security count
R language uses GT package and gtextras package to display tabular data beautifully: GT_ bar_ Plot function and GT_ plt_ bar_ PCT function visual percentage bar graph, percentage bar graph of original