真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

java簡單煙花代碼 用java編寫煙花

2022年跨年煙花代碼可復(fù)制

煙花代碼如下:

創(chuàng)新互聯(lián)建站是一家做網(wǎng)站、成都做網(wǎng)站,提供網(wǎng)頁設(shè)計(jì),網(wǎng)站設(shè)計(jì),網(wǎng)站制作,建網(wǎng)站,按需定制開發(fā),網(wǎng)站開發(fā)公司,從2013年成立是互聯(lián)行業(yè)建設(shè)者,服務(wù)者。以提升客戶品牌價(jià)值為核心業(yè)務(wù),全程參與項(xiàng)目的網(wǎng)站策劃設(shè)計(jì)制作,前端開發(fā),后臺(tái)程序制作以及后期項(xiàng)目運(yùn)營并提出專業(yè)建議和思路。

package love;

import java.applet.Applet;

import java.awt.Color;

import java.awt.Graphics;

import java點(diǎn)虐 .URL;

import java.util.Random;

煙花

@author enjoy

@SuppressWarnings("serial")

public class Q extends Applet implements Runnable

public int speed, variability, Max_Number, Max_Energy, Max_Patch,

Max_Length, G;

public String sound;

private int width, height;

private Thread thread = null;

private BeaClassDemo bcd[];

public void init()? ? ? ? ? ? ? ? ? ? ?

int i;

this.setSize(1900, 900);

width = getSize().width - 1;

height = getSize().height - 1;

speed = 1;??????????????????????? // 煙花綻放的速度

variability = 10;

Max_Number = 980;??????????????????? // 可發(fā)出煙花的最大數(shù)目

Max_Energy = width + 50;

Max_Patch = 90;??????????????????? // 最大的斑點(diǎn)數(shù)

Max_Length = 90;??????????????????? // 斑點(diǎn)的最大距離

G = 150;??????????????????????????? // 向地面彎曲的力度

bcd = new BeaClassDemo[Max_Number];

for (i = 0; i Max_Number; i++)

bcd[i] = new BeaClassDemo(width, height, G);

}

public void start() {

if (thread == null) {

thread = new Thread(this);

thread.start();

}

}

@SuppressWarnings("deprecation")

public void stop() {

if (thread != null) {

thread.stop();

thread = null;

}

}

@SuppressWarnings({ "unused", "static-access" })

public void run() {

int i;

int E = (int) (Math.random() * Max_Energy * 3 / 4) + Max_Energy / 4 + 1;

int P = (int) (Math.random() * Max_Patch * 3 / 4)??? // 煙花的斑點(diǎn)數(shù)

+ Max_Patch / 4 + 1;

int L = (int) (Math.random() * Max_Length * 3 / 4)??? // 煙花可發(fā)射出的距離

+ Max_Length / 4 + 1;

long S = (long) (Math.random() * 10000);

boolean sleep;

Graphics g = getGraphics();

URL u = null;

while (true) {

try {

thread.sleep(1000 / speed);

catch (InterruptedException x) {

sleep = true;

for (i = 0; i Max_Number; i++)

sleep = sleep bcd[i].sleep;

if (sleep Math.random() * 100 variability) {

E = (int) (Math.random() * Max_Energy * 3 / 4) + Max_Energy / 4

+ 1;

P = (int) (Math.random() * Max_Patch * 3 / 4) + Max_Patch / 4

+ 1;

L = (int) (Math.random() * Max_Length * 3 / 4) + Max_Length / 4

+ 1;

S = (long) (Math.random() * 10000);

for (i = 0; i Max_Number; i++) {

if (bcd[i].sleep Math.random() * Max_Number * L 1)

bcd[i].init(E, P, L, S);

bcd[i].start();

bcd[i].show(g);

public void paint(Graphics g)? ? ? ? ? ? ? ? ?

g.setColor(Color.black);

g.fillRect(0, 0, width + 1, height + 1);

class BeaClassDemo

public boolean sleep = true;

private int energy, patch, length, width, height, G, Xx, Xy, Ex[], Ey[], x,

y, Red, Blue, Green, t;

private Random random;

public BeaClassDemo(int a, int b, int g)? ? ? ?

width = a;

height = b;

G = g;

public void init(int e, int p, int l, long seed)?

int i;

energy = e;

patch = p;

length = l;

// 創(chuàng)建一個(gè)帶種子的隨機(jī)數(shù)生成器

random = new Random(seed);

Ex = new int[patch];

Ey = new int[patch];

Red = (int) (random.nextDouble() * 128) + 128;

Blue = (int) (random.nextDouble() * 128) + 128;

Green = (int) (random.nextDouble() * 128) + 128;

Xx = (int) (Math.random() * width / 2) + width / 4;

Xy = (int) (Math.random() * height / 2) + height / 4;

for (i = 0; i patch; i++) {

Ex[i] = (int) (Math.random() * energy) - energy / 2;

Ey[i] = (int) (Math.random() * energy * 7 / 8) - energy / 8;

public void start

t = 0;

sleep = false;

public void show(Graphics g)? ? ?

if (!sleep)??????????????????

if (t length)

int i, c;

double s;

Color color;

c = (int) (random.nextDouble() * 64) - 32 + Red;

if (c = 0 c 256)

Red = c;

c = (int) (random.nextDouble() * 64) - 32 + Blue;

if (c = 0 c 256)

Blue = c;

c = (int) (random.nextDouble() * 64) - 32 + Green;

if (c = 0 c 256)

Green = c;

color = new Color(Red, Blue, Green);

for (i = 0; i patch; i++)

s = (double) t / 100;

x = (int) (Ex[i] * s);

y = (int) (Ey[i] * s - G * s * s);

g.setColor(color);

g.drawLine(Xx + x, Xy - y, Xx + x, Xy - y);

if (t = length / 2)

int j;

for (j = 0; j 2; j++)

s = (double) ((t - length / 2) * 2 + j) / 100;

x = (int) (Ex[i] * s);

y = (int) (Ey[i] * s - G * s * s);

g.setColor(Color.black);

g.drawLine(Xx + x, Xy - y, Xx + x, Xy - y);

常用的編程語言。

編程語言一:C語言

C語言是世界上最流行、使用最廣泛的高級(jí)程序設(shè)計(jì)語言之一。在操作系統(tǒng)和系統(tǒng)使用程序以及需要對(duì)硬件進(jìn)行操作的場(chǎng)合,用C語言明顯優(yōu)于其它高級(jí)語言,許多大型應(yīng)用軟件都是用C語言編寫的。

編程語言二:java

Java是一種可以撰寫跨平臺(tái)應(yīng)用軟件的面向?qū)ο蟮某绦蛟O(shè)計(jì)語言,是由Sun Microsystems公司于1995年5月推出的Java程序設(shè)計(jì)語言和Java平臺(tái)(即JavaSE, JavaEE, JavaME)的總稱。

編程語言三:c++

C++這個(gè)詞在中國大陸的程序員圈子中通常被讀做“C加加”,而西方的程序員通常讀做“C plus plus" , "CPP”。 它是一種使用非常廣泛的計(jì)算機(jī)編程語言。C++是一種靜態(tài)數(shù)據(jù)類型檢查的、支持多重編程范式的通用程序設(shè)計(jì)語言。

放煙花的代碼

# -*- coding: utf-8 -*-import math, random,timeimport threadingimport tkinter as tkimport re uuidFireworks=[]maxFireworks=8height,width=600,600class firework(object):def __init__(self,color,speed,width,height):=uuid.uuid1()self.radius=random.randint(2,4) ~4像素self.color=color self.speed=speed .5-3.5秒self.status=0 ,status=0;爆炸后,status=1;當(dāng)status100時(shí),煙花的生命期終止self.nParticle=random.randint(20,30) self.center=[random.randint(0,width-1),random.randint(0,height-1)] self.oneParticle=[] (100%狀態(tài)時(shí))self.rotTheta=random.uniform(0,2*math.pi) :x=a*cos(theta),y=b*sin(theta)=[a,b]

煙花的java程序

// Decompiled by DJ v2.9.9.60 Copyright 2000 Atanas Neshkov Date: 2003-1-8 9:49:09

// Home Page : - Check often for new version!

// Decompiler options: packimports(3)

// Source File Name: jhanabi.java

import java.applet.Applet;

import java.applet.AudioClip;

import java.awt.*;

import java.awt.image.MemoryImageSource;

import java.util.Random;

public class jhanabi extends Applet

implements Runnable

{

public jhanabi()

{

m_mouseX = 0;

m_mouseY = 0;

m_sleepTime = 5;

isError = false;

isInitialized = false;

rand = new Random();

bits = 10000;

bit_px = new double[bits];

bit_py = new double[bits];

bit_vx = new double[bits];

bit_vy = new double[bits];

bit_sx = new int[bits];

bit_sy = new int[bits];

bit_l = new int[bits];

bit_f = new int[bits];

bit_p = new int[bits];

bit_c = new int[bits];

ru = 50;

rv = 50;

}

public void init()

{

String s = getParameter("para_bits");

if(s != null)

bits = Integer.parseInt(s);

s = getParameter("para_max");

if(s != null)

bit_max = Integer.parseInt(s);

s = getParameter("para_blendx");

if(s != null)

ru = Integer.parseInt(s);

s = getParameter("para_blendy");

if(s != null)

rv = Integer.parseInt(s);

s = getParameter("para_sound");

if(s != null)

bit_sound = Integer.parseInt(s);

m_nAppX = size().width;

m_nAppY = size().height;

m_centerX = m_nAppX / 2;

m_centerY = m_nAppY / 2;

m_mouseX = m_centerX;

m_mouseY = m_centerY;

resize(m_nAppX, m_nAppY);

pixls = m_nAppX * m_nAppY;

pixls2 = pixls - m_nAppX * 2;

pix0 = new int[pixls];

offImage = new MemoryImageSource(m_nAppX, m_nAppY, pix0, 0, m_nAppX);

offImage.setAnimated(true);

dbImg = createImage(offImage);

for(int i = 0; i pixls; i++)

pix0[i] = 0xff000000;

sound1 = getAudioClip(getDocumentBase(), "firework.au");

sound2 = getAudioClip(getDocumentBase(), "syu.au");

for(int j = 0; j bits; j++)

bit_f[j] = 0;

isInitialized = true;

start();

}

public void run()

{

while(!isInitialized)

try

{

Thread.sleep(200L);

}

catch(InterruptedException interruptedexception) { }

do

{

for(int j = 0; j pixls2; j++)

{

int k = pix0[j];

int l = pix0[j + 1];

int i1 = pix0[j + m_nAppX];

int j1 = pix0[j + m_nAppX + 1];

int i = (k 0xff0000) 16;

int k1 = ((((l 0xff0000) 16) - i) * ru 8) + i;

i = (k 0xff00) 8;

int l1 = ((((l 0xff00) 8) - i) * ru 8) + i;

i = k 0xff;

int i2 = (((l 0xff) - i) * ru 8) + i;

i = (i1 0xff0000) 16;

int j2 = ((((j1 0xff0000) 16) - i) * ru 8) + i;

i = (i1 0xff00) 8;

int k2 = ((((j1 0xff00) 8) - i) * ru 8) + i;

i = i1 0xff;

int l2 = (((j1 0xff) - i) * ru 8) + i;

int i3 = ((j2 - k1) * rv 8) + k1;

int j3 = ((k2 - l1) * rv 8) + l1;

int k3 = ((l2 - i2) * rv 8) + i2;

pix0[j] = i3 16 | j3 8 | k3 | 0xff000000;

}

rend();

offImage.newPixels(0, 0, m_nAppX, m_nAppY);

try

{

Thread.sleep(m_sleepTime);

}

catch(InterruptedException interruptedexception1) { }

} while(true);

}

public void update(Graphics g)

{

paint(g);

}

public void paint(Graphics g)

{

g.drawImage(dbImg, 0, 0, this);

}

public void start()

{

if(isError)

return;

isRunning = true;

if(runner == null)

{

runner = new Thread(this);

runner.start();

}

}

public void stop()

{

if(runner != null)

{

runner.stop();

runner = null;

}

}

public boolean mouseMove(Event event, int i, int j)

{

m_mouseX = i;

m_mouseY = j;

return true;

}

public boolean mouseDown(Event event, int i, int j)

{

m_mouseX = i;

m_mouseY = j;

int k = (int)(rand.nextDouble() * 256D);

int l = (int)(rand.nextDouble() * 256D);

int i1 = (int)(rand.nextDouble() * 256D);

int j1 = k 16 | l 8 | i1 | 0xff000000;

int k1 = 0;

for(int l1 = 0; l1 bits; l1++)

{

if(bit_f[l1] != 0)

continue;

bit_px[l1] = m_mouseX;

bit_py[l1] = m_mouseY;

double d = rand.nextDouble() * 6.2800000000000002D;

double d1 = rand.nextDouble();

bit_vx[l1] = Math.sin(d) * d1;

bit_vy[l1] = Math.cos(d) * d1;

bit_l[l1] = (int)(rand.nextDouble() * 100D) + 100;

bit_p[l1] = (int)(rand.nextDouble() * 3D);

bit_c[l1] = j1;

bit_sx[l1] = m_mouseX;

bit_sy[l1] = m_nAppY - 5;

bit_f[l1] = 2;

if(++k1 == bit_max)

break;

}

if(bit_sound 1)

sound2.play();

return true;

}

public boolean mouseExit(Event event, int i, int j)

{

m_mouseX = i;

m_mouseY = j;

return true;

}

void rend()

{

boolean flag = false;

boolean flag1 = false;

boolean flag2 = false;

for(int k = 0; k bits; k++)

switch(bit_f[k])

{

default:

break;

case 1: // '\001'

bit_vy[k] += rand.nextDouble() / 50D;

bit_px[k] += bit_vx[k];

bit_py[k] += bit_vy[k];

bit_l[k]--;

if(bit_l[k] == 0 || bit_px[k] 0.0D || bit_py[k] 0.0D || bit_px[k] (double)m_nAppX || bit_py[k] (double)(m_nAppY - 3))

{

bit_c[k] = 0xff000000;

bit_f[k] = 0;

} else

if(bit_p[k] == 0)

{

if((int)(rand.nextDouble() * 2D) == 0)

bit_set((int)bit_px[k], (int)bit_py[k], -1);

} else

{

bit_set((int)bit_px[k], (int)bit_py[k], bit_c[k]);

}

break;

case 2: // '\002'

bit_sy[k] -= 5;

if((double)bit_sy[k] = bit_py[k])

{

bit_f[k] = 1;

flag2 = true;

}

if((int)(rand.nextDouble() * 20D) == 0)

{

int i = (int)(rand.nextDouble() * 2D);

int j = (int)(rand.nextDouble() * 5D);

bit_set(bit_sx[k] + i, bit_sy[k] + j, -1);

}

break;

}

if(flag2 bit_sound 0)

sound1.play();

}

void bit_set(int i, int j, int k)

{

int l = i + j * m_nAppX;

pix0[l] = k;

}

private int m_nAppX;

private int m_nAppY;

private int m_centerX;

private int m_centerY;

private int m_mouseX;

private int m_mouseY;

private int m_sleepTime;

private boolean isError;

private boolean m_isPaintFinished;

boolean isRunning;

boolean isInitialized;

Thread runner;

int pix0[];

MemoryImageSource offImage;

Image dbImg;

int pixls;

int pixls2;

Random rand;

int bits;

double bit_px[];

double bit_py[];

double bit_vx[];

double bit_vy[];

int bit_sx[];

int bit_sy[];

int bit_l[];

int bit_f[];

int bit_p[];

int bit_c[];

int bit_max;

int bit_sound;

int ru;

int rv;

AudioClip sound1;

AudioClip sound2;

}


新聞標(biāo)題:java簡單煙花代碼 用java編寫煙花
本文地址:http://weahome.cn/article/ddjccgi.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部