烟花编程教程(烟花编程教程图片)
c语言编程烟花代码简单
c语言编程烟花代码简单如下:
#include "stdlib.h"
#include "graphics.h"
#include "stdio.h"
#include "math.h"
#include "conio.h "
#define PI? 3.1425926
main()
{
int gdriver=DETECT,gmode,errorcode;
int a[10],b[10],x,y,c,r,i,j,t;
double rad = 0.0;
/* initialize graphics and local variables */
initgraph(gdriver , gmode ,"");
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk)? /* an error occurred */
{
printf("Graphics error : %s/n",grapherrormsg(errorcode));
printf("Please any key to halt:");
getch();
exit(1);? /* terminate with an error code */
}
randomize();
for(;!kbhit();)
{
x=rand()%500+100; /*随机中心坐标*/
y=rand()%300+100;
for(r = 0 ;r = 8 ; r++? )? ? /*烟花的大小设定*/
{
for(i = 0,rad = 0.0 ; rad 2*PI; rad += 0.78 )? /*设定坐标*/
{
a[i++] = x + (int)r *10* cos(rad);
b[ i ] = y + (int)r *10* sin(rad);
}
t = i;
for(i=1;it;i++)
{
c=rand()%13+1; /*各点的颜色随机*/
setcolor(c);? ? ? ?/*功能:将当前图形屏幕的当前笔画颜色置为color.*/
circle(a[i],b[i],1);/* a[i],b[i] 为圆心 1 为半径 画圆 */
}
delay(10000);
delay(10000);
cleardevice();
函数名: cleardevice? ? ? ? ?
功? 能: 清除图形屏幕?
用? 法: void far cleardevice(void);
}
}
getch();
closegraph();
函数名: closegraph
功? 能: 关闭图形系统
用? 法: void far closegraph(void);
}
初始化烟花参数
void Init( int i )
{
// 分别为:烟花中心到图片边缘的最远距离、烟花中心到图片左上角的距离 (x、y) 两个分量
int r[13] = { 120, 120, 155, 123, 130, 147, 138, 138, 130, 135, 140, 132, 155 };
int x[13] = { 120, 120, 110, 117, 110, 93, 102, 102, 110, 105, 100, 108, 110 };
int y[13] = { 120, 120, 85, 118, 120, 103, 105, 110, 110, 120, 120, 104, 85 };
/**** 初始化烟花 *****/
Fire[i].x = 0; // 烟花中心坐标
Fire[i].y = 0;
Fire[i].width = 240; // 图片宽
Fire[i].height = 240; // 图片高
Fire[i].max_r = r[i]; // 最大半径
Fire[i].cen_x = x[i]; // 中心距左上角距离
Fire[i].cen_y = y[i];
Fire[i].show = false; // 是否绽放
Fire[i].dt = 5; // 绽放时间间隔
Fire[i].t1 = timeGetTime();
Fire[i].r = 0; // 从 0 开始绽放
/**** 初始化烟花弹 *****/
Jet[i].x = -240; // 烟花弹左上角坐标
Jet[i].y = -240;
Jet[i].hx = -240; // 烟花弹发射最高点坐标
Jet[i].hy = -240;
Jet[i].height = 0; // 发射高度
Jet[i].t1 = timeGetTime();
Jet[i].dt = rand() % 10; // 发射速度时间间隔
Jet[i].n = 0; // 烟花弹闪烁图片下标
Jet[i].shoot = false; // 是否发射
}
c语言放烟花代码
#include "stdlib.h"
#include "graphics.h"
#include "stdio.h"
#include "math.h"
#include "conio.h "
#define PI? 3.1425926
main()
{
int gdriver=DETECT,gmode,errorcode;
int a[10],b[10],x,y,c,r,i,j,t;
double rad = 0.0;
/* initialize graphics and local variables */
initgraph(gdriver , gmode ,"");
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk)? /* an error occurred */
{
printf("Graphics error : %s/n",grapherrormsg(errorcode));
printf("Please any key to halt:");
getch();
exit(1);? /* terminate with an error code */
}
randomize();
for(;!kbhit();)
{
x=rand()%500+100; /*随机中心坐标*/
y=rand()%300+100;
for(r = 0 ;r = 8 ; r++? )? ? /*烟花的大小设定*/
{
for(i = 0,rad = 0.0 ; rad 2*PI; rad += 0.78 )? /*设定坐标*/
{
a[i++] = x + (int)r *10* cos(rad);
b[ i ] = y + (int)r *10* sin(rad);
}
t = i;
for(i=1;it;i++)
{
c=rand()%13+1; /*各点的颜色随机*/
setcolor(c);? ? ? ?/*功能:将当前图形屏幕的当前笔画颜色置为color.*/
circle(a[i],b[i],1);/* a[i],b[i] 为圆心 1 为半径 画圆 */
}
delay(10000);
delay(10000);
cleardevice();
函数名: cleardevice? ? ? ? ?
功? 能: 清除图形屏幕?
用? 法: void far cleardevice(void);
}
}
getch();
closegraph();
函数名: closegraph
功? 能: 关闭图形系统
用? 法: void far closegraph(void);
}
扩展资料
C语言:表白显示(多彩小心心)
#include stdio.h
#include math.h
#include stdlib.h
#define I 20
#define R 340
#include string.h
int main()
{
char answer[10];
printf("遇到你\n我才发现\n曾经所有的条件\n似乎都成了我等你的借口\n\n");
printf("我对你的感情已经决堤\n所以\n请允许我,从今往后映入你\n明媚的眼\n");
printf("我\n想和你\n耳鬓厮磨,相濡以沫!");
printf("答应我吧!\n输入yes,你可以看到我的真心\n");
scanf("%s", answer);
float y, x, z, f;
for (y = 1.5f; y -1.5f; y -= 0.1f)
{
for (x = -1.5f; x 1.5f; x += 0.05f)
{
z = x * x + y * y - 1;
f = z * z*z - x * x*y*y*y;
putchar(f = 0.0f ? "*********"[(int)(f*-8.0f)] : ' ');
}
putchar('\n');
}
long time;
for (;;)
{
system("color a");
for (time = 0; time99999999; time++);
system("color b");
for (time = 0; time99999999; time++);
system("color c");
for (time = 0; time99999999; time++);
system("color d");
for (time = 0; time99999999; time++);
system("color e");
for (time = 0; time99999999; time++);
system("color f");
for (time = 0; time99999999; time++);
system("color 0");
for (time = 0; time99999999; time++);
system("color 1");
for (time = 0; time99999999; time++);
system("color 2");
for (time = 0; time99999999; time++);
system("color 3");
for (time = 0; time99999999; time++);
system("color 4");
for (time = 0; time99999999; time++);
system("color 5");
for (time = 0; time99999999; time++);
system("color 6");
for (time = 0; time99999999; time++);
system("color 7");
for (time = 0; time99999999; time++);
system("color 8");
for (time = 0; time99999999; time++);
system("color 9");
}
getchar();
return 0;
}
mc心形烟花教程
mc心形烟花教程如下:
1、首先,我们准备火药、火焰弹、任意染料、纸。
2、用这些材料先制作一个烟火之星。
3、然后,我们就可以做出烟花啦。
4、注意,此时烟花的飞行时间为1,加的火药越多,飞行时间越长,但是最多只能放3个火药。
5、拿着烟花,右键地面就可以燃放。
烟花在古代叫爆竹,古代过年时人们以火烧竹,爆裂发声,“爆竹”一名由此而来。又称烟火、焰火,在中国发明较早,主要用于军事上、盛大的典礼或表演中,而现代全球唯一能在同天同活动里施放烟花的活动则为跨年(除夕夜)活动。
现在有很多的地方在举行一些大型的活动或者有一些节日的时候都会用到烟花。明人张时辙在《陈都阃宅看烟花》诗中,对烟花燃放空中的景物作了生动的描绘:“空中捧出百丝灯,神女新妆五彩明。真有斩蛟动长剑,狂客吹箫过洞庭”。
烟花爆竹的历史可以追溯到我国湖南省浏阳市。它被称为“世界烟花之都”,是我国“烟花生产”的主要中心。我国被认为是世界上最大的烟花生产地和出口国。
可以相信,隋唐时期(公元581-907年)发现了第一个烟火成分。记录显示,它是由我国炼金术士发现的,他们通过尝试各种物质的组合来炼制“长生不老药”,据传该药可以确保长寿甚至永生。
新年烟花代码
烟花链接代码的操作步骤如下:
操作环境:华硕飞行堡垒、windows10家庭版、DreamweaverCS6。
1、打开Dreamweaver,新建HTML。
2、创建一个div标签,书写属性。
3、在<body>辩余内添加罩灶运js代码。
4、在<script>内添加js内容。
什么是电子烟花?
电子烟花是一种新型的电子产品,它有别于传统的装药烟花:
1·电子烟花是利用喷向空中的彩色纸屑反射彩色灯光结合哨子发出的啸叫声来产生火药烟花的燃放效果,可重复使用,没有硝烟,不产生垃圾,同样绚丽多姿;
2·利用电子激发普通空气爆炸,不使用火药和任何爆炸、燃烧药剂,也不使用任何燃烧助燃气体,在爆炸闪光过程中不产生烟雾,在爆炸、闪光过程中不伤人、不起火,并且能释放大量的负离子清洁空气;
3·电子烟花室内外都能用,有手持式、坐地式和多管式,均可同时使用。
想用c#做一个烟花的动画,用窗口还是程序台?思路是什么,怎么写?求大神指教我是初学者,什么都不懂
控制台肯定不行。窗口程序至少属于可视化界面。
初学者别搞这个了,你要做的这个可以用其他软件更方便实现。
非要用C#的winform来做动画,研究一下System.Drawing吧。
至于编程思路可以简单给你讲一个:
定义个烟花类:
属性:
烟花的颜色【Color】,
烟花当前位置【Point】,
飞行方向【int】,
飞行轨迹【Point集合】,
烟花尾巴长度【int】,
爆炸生成烟花数量【int】
方法:
烟花爆炸()——如果爆炸生成的烟花数量设置是0,那么就不爆炸;否则安装数量new 新的烟花出来,360°除以烟花数量设置烟花方向。
烟花飞行()——飞行轨迹记录之前的位置,通过飞行方向计算当前位置,通过尾巴长度颜色属性进行图像刷新。
。。。。。。