成都创新互联网站制作重庆分公司

java烟花代码源码,java小程序代码烟花

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;

}

在编写那个烟花的程序(java),以下是对烟花进行绘制的代码,我是新手看不懂,请帮忙解释下呢··

就是找了三个随机数, r,g,b作为颜色的初始色彩,在三个数字上偏移, 得到相近的颜色.. 并画出来..

百度上java烟花代码改成按类编写,改变其烟花消失方式,实现鼠标一点实现多个烟花绽放

喔哇,

都是啥子年代了,

还食古不化,

在触摸屏幕用手指划动而产生燃放烟花的虚拟图像效果,

早就被时代彻底底抛弃了!!

现在都是在空中一划,根据手势,根据手势的空间运动,

立即就是实际来真格的,

真实、震撼、空间大爆炸、场面骇人、惊天动地。

无接触,

摒弃虚拟的虚假玩意儿。

你吹一口气,

燃放装置就喷出一股火焰。

机械加工能力和基础强劲的,

产生1米边长见方立体焰火造型,

与产生100米见方焰火造型的设备是通用的。

你与情侣自拍“刷脸”就立即产生肖像燃放造型,

其详细的工程技术细节,

早就有中英文对照的文本,

照着去做就可以了,

无需操作机床加工的人员,

去“进一步研究思考”、去开展“创造性的工作”。

java烟花程序看不懂,求解释!

import java.awt.*;

import java.applet.*;

import java.awt.event.*;

import javax.swing.*;

public class Fireworks extends Applet implements MouseListener, Runnable {

int x, y;//记录鼠标点击的坐标

int top, point;//好像没用到

public void init() {

x = 0;

y = 0;

setBackground(Color.black);// 设置背景色为黑色

addMouseListener(this);//添加鼠标监听

}

public void paint(Graphics g) {

}

public static void main(String args[]) {

Fireworks applet = new Fireworks();

JFrame frame = new JFrame("TextAreaNew");

frame.addWindowListener(new WindowAdapter() {

public void windowClosing(WindowEvent e) {//右上角的叉

System.exit(0);

}

});

frame.add(applet, BorderLayout.CENTER);

frame.setSize(800, 400);//程序的框框大小

applet.init();

applet.start();

frame.setVisible(true);//

}

public void run() {

// 变量初始化

Graphics g1;

g1 = getGraphics();//这是画笔,得到一个画笔

int y_move, y_click, x_click;

int v;//用于计算等待的时间

x_click = x;

y_click = y;//把点击的坐标保存下来,因为其它线程会去改这两个坐标。

y_move = 400;//用来计算变动的那个点,现在是屏幕的最大高度

v = 3;

int r, g, b;

while (y_move  y_click)//如果点击的位置小于最大高度。

{

g1.setColor(Color.black);//画笔设成黑色

g1.fillOval(x_click, y_move, 5, 5);//画圆,圆点在点击的X轴,程序界面的最高点,长为5,宽为5

y_move -= 5;//最高点-5

r = (((int) Math.round(Math.random() * 4321)) % 200) + 55;

g = (((int) Math.round(Math.random() * 4321)) % 200) + 55;

b = (((int) Math.round(Math.random() * 4321)) % 200) + 55;//rgb是光的三原色,这个就是烟花产生的颜色,这里定义成随机的,但在一个范围里

g1.setColor(new Color(r, g, b));//把画笔改成那个颜色

g1.fillOval(x_click, y_move, 5, 5);//画一个这样的圆

for (int j = 0; j = 10; j++) {

if (r  55)

r -= 20;

if (g  55)

g -= 20;

if (b  55)

b -= 20;

g1.setColor(new Color(r, g, b));

g1.fillOval(x_click, y_move + j * 5, 5, 5);//这一段都是改变颜色,然后画圆的

}

g1.setColor(Color.black);

g1.fillOval(x_click, y_move + 5 * 10, 5, 5);//把上一次画的彩色圆,用黑色画一遍,就能让它消失在背景里

try {

Thread.currentThread().sleep(v++);//让程序等一下,让你看到效果,不然画完的东西一下就不见了,你看不清。

} catch (InterruptedException e) {

}

}//上面这段代码是烟花的升上去的那一串东西的效果

for (int j = 12; j = 0; j--) {

g1.setColor(Color.black);

g1.fillOval(x_click, y_move + (j * 5), 5, 5);

try {

Thread.currentThread().sleep((v++) / 3);

} catch (InterruptedException e) {

}

}//让最后的那串东西的点消失

y_move = 400;

g1.setColor(Color.black);

while (y_move  y_click) {

g1.fillOval(x_click - 2, y_move, 9, 5);

y_move -= 5;

}//这段不太清楚是干什么的,我把它去掉,看不出效果的变化

v = 15;

for (int i = 0; i = 25; i++) {

r = (((int) Math.round(Math.random() * 4321)) % 200) + 55;

g = (((int) Math.round(Math.random() * 4321)) % 200) + 55;

b = (((int) Math.round(Math.random() * 4321)) % 200) + 55;

g1.setColor(new Color(r, g, b));

g1.drawOval(x_click - 3 * i, y_click - 3 * i, 6 * i, 6 * i);

if (i  23) {

g1.drawOval(x_click - 3 * (i + 1), y_click - 3 * (i + 1),

6 * (i + 1), 6 * (i + 1));

g1.drawOval(x_click - 3 * (i + 2), y_click - 3 * (i + 2),

6 * (i + 2), 6 * (i + 2));

}//上面这段是画爆炸的效果

try {

Thread.currentThread().sleep(v++);//停一下,看效果

} catch (InterruptedException e) {

}

g1.setColor(Color.black);

g1.drawOval(x_click - 3 * i, y_click - 3 * i, 6 * i, 6 * i);//然后画黑圈,相当于让彩圈消失。

}

}

public void mousePressed(MouseEvent e) {//点击从这里开始~~~~~~~~~~~~~~

x = e.getX();

y = e.getY();//得到鼠标点击的坐标

Thread one = new Thread(this);//新建一个线程

one.start();//启动这个线程,到上面的run方法

one = null;//把这个线程置为空,让它执行完以后就释放

}

如果你想一下自己写要怎样写这个程序,就很容易理解这个程序了。

一直从下向上画圆,然后把下面的圆擦掉,就能得到一个向上升的烟花效果,

爆炸效果就是先画小圆再画大圆,然后擦掉小圆,再擦掉大圆。

关于java特效烟花

一个脚本 QQ空间不支持

你找个FLASH带JAVA脚本的 然后找出正确地址.

然后在QQ空间的自定义 添加模块 FLASH模块里

把地址复制上点确定 再托大到合适角度 一样有这样的效果

QQ空间代码的网站都有 百度一找一堆!

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; // 是否发射

}


分享名称:java烟花代码源码,java小程序代码烟花
转载来源:http://cxhlcq.com/article/hsehje.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部