📄 effect.h
字号:
#include "head.h"
/*头文件、常量定义*/
#define N 40
#define WW 640
#define HH 480
#define wait delay(60000);delay(60000)
void effectWindow1(int color)/*水平百叶窗*/
{
int i,j;
setcolor(color);
for(i=0;i<N;i++)
{
for(j=0;j<480;j+=N)
{
line(0,j+i,639,j+i);
delay(100);
}
}
}
void effectWindow2(int color)/*垂直百叶窗*/
{
int i,j;
setcolor(color);
for(i=0;i<N;i++)
{
for(j=0;j<640;j+=N)
{
line(j+i,0,j+i,479);
delay(100);
}
}
}
void randLine1(int color)/*水平随机线*/
{
int a[WW],b[WW],i,t;
setcolor(color);
for(i=0;i<WW;i++)
a[i]=i;
for(i=0;i<WW;i++)
{
t=random(WW-i);
b[i]=a[t];
a[t]=a[WW-i-1];
}
for(i=0;i<WW;i++)
{
line(b[i],0,b[i],479);
delay(200);
}
}
void randLine2(int color)/*垂直随机线*/
{
int a[HH],b[HH],i,t;
setcolor(color);
for(i=0;i<HH;i++)
a[i]=i;
for(i=0;i<HH;i++)
{
t=random(HH-i);
b[i]=a[t];
a[t]=a[HH-i-1];
}
for(i=0;i<HH;i++)
{
line(0,b[i],639,b[i]);
delay(200);
}
}
void effect(void)
{
switch(random(4))
{
case 0:effectWindow1(random(15)+1);wait;effectWindow1(0);break;
case 1:effectWindow2(random(15)+1);wait;effectWindow2(0);break;
case 2:randLine1(random(15)+1);wait;randLine1(0);break;
case 3:randLine2(random(15)+1);wait;randLine2(0);break;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -