烟花javascript,烟花视频
如何用javascript做出点击屏幕产生烟花效果
!DOCTYPE html
成都创新互联公司是一家专业提供伊川企业网站建设,专注与成都网站制作、成都网站设计、H5开发、小程序制作等业务。10年已为伊川众多企业、政府机构等服务。创新互联专业网络公司优惠进行中。
!-- saved from url= --
html
headmeta http-equiv="Content-Type" content="text/html; charset=UTF-8"
meta content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport"
meta name="apple-mobile-web-app-capable" content="yes"
meta name="apple-mobile-web-app-status-bar-style" content="black"
title烟花/title
style type="text/css"
html,body{height:100%;margin:0;padding:0}
ul,li{text-indent:0;text-decoration:none;margin:0;padding:0}
img{border:0}
body{background-color:#000;color:#999;font:100%/18px helvetica, arial, sans-serif}
canvas{cursor:crosshair;display:block;left:0;position:absolute;top:0;z-index:20}
#header img{width:100%; height:20%;}
#bg img{width:100%; height:80%;}
#header,#bg{position:fixed;left:0;right:0;z-index:10}
#header{top:0}
#bg{position:fixed;z-index:1;}
audio{position:fixed;display:none;bottom:0;left:0;right:0;width:100%;z-index:5}
/style
link rel="shortcut icon" type="image/x-icon" href=""
style type="text/css"/stylestyle id="style-1-cropbar-clipper"
.en-markup-crop-options {
top: 18px !important;
left: 50% !important;
margin-left: -100px !important;
width: 200px !important;
border: 2px rgba(255,255,255,.38) solid !important;
border-radius: 4px !important;
}
.en-markup-crop-options div div:first-of-type {
margin-left: 0px !important;
}
#.bg {
background-color: black;
}
/style
/head
body
div id="bg"/div
script src=""/script
script type="text/javascript"
$(function(){
var Fireworks = function(){
var self = this;
var rand = function(rMi, rMa){return ~~((Math.random()*(rMa-rMi+1))+rMi);}
var hitTest = function(x1, y1, w1, h1, x2, y2, w2, h2){return !(x1 + w1 x2 || x2 + w2 x1 || y1 + h1 y2 || y2 + h2 y1);};
window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)}}();
self.init = function(){
self.canvas = document.createElement('canvas');
self.canvas.width = self.cw = $(window).innerWidth();
self.canvas.height = self.ch = $(window).innerHeight();
self.particles = [];
self.partCount = 150;
self.fireworks = [];
self.mx = self.cw/2;
self.my = self.ch/2;
self.currentHue = 30;
self.partSpeed = 5;
self.partSpeedVariance = 10;
self.partWind = 50;
self.partFriction = 5;
self.partGravity = 1;
self.hueMin = 0;
self.hueMax = 360;
self.fworkSpeed = 4;
self.fworkAccel = 10;
self.hueVariance = 30;
self.flickerDensity = 25;
self.showShockwave = true;
self.showTarget = false;
self.clearAlpha = 25;
$(document.body).append(self.canvas);
self.ctx = self.canvas.getContext('2d');
self.ctx.lineCap = 'round';
self.ctx.lineJoin = 'round';
self.lineWidth = 1;
self.bindEvents();
self.canvasLoop();
self.canvas.onselectstart = function() {
return false;
};
};
self.createParticles = function(x,y, hue){
var countdown = self.partCount;
while(countdown--){
var newParticle = {
x: x,
y: y,
coordLast: [
{x: x, y: y},
{x: x, y: y},
{x: x, y: y}
],
angle: rand(0, 360),
speed: rand(((self.partSpeed - self.partSpeedVariance) = 0) ? 1 : self.partSpeed - self.partSpeedVariance, (self.partSpeed + self.partSpeedVariance)),
friction: 1 - self.partFriction/100,
gravity: self.partGravity/2,
hue: rand(hue-self.hueVariance, hue+self.hueVariance),
brightness: rand(50, 80),
alpha: rand(40,100)/100,
decay: rand(10, 50)/1000,
wind: (rand(0, self.partWind) - (self.partWind/2))/25,
lineWidth: self.lineWidth
};
self.particles.push(newParticle);
}
};
self.updateParticles = function(){
var i = self.particles.length;
while(i--){
var p = self.particles[i];
var radians = p.angle * Math.PI / 180;
var vx = Math.cos(radians) * p.speed;
var vy = Math.sin(radians) * p.speed;
p.speed *= p.friction;
p.coordLast[2].x = p.coordLast[1].x;
p.coordLast[2].y = p.coordLast[1].y;
p.coordLast[1].x = p.coordLast[0].x;
p.coordLast[1].y = p.coordLast[0].y;
p.coordLast[0].x = p.x;
p.coordLast[0].y = p.y;
p.x += vx;
p.y += vy;
p.y += p.gravity;
p.angle += p.wind;
p.alpha -= p.decay;
if(!hitTest(0,0,self.cw,self.ch,p.x-p.radius, p.y-p.radius, p.radius*2, p.radius*2) || p.alpha .05){
self.particles.splice(i, 1);
}
};
};
self.drawParticles = function(){
var i = self.particles.length;
while(i--){
var p = self.particles[i];
var coordRand = (rand(1,3)-1);
self.ctx.beginPath();
self.ctx.moveTo(Math.round(p.coordLast[coordRand].x), Math.round(p.coordLast[coordRand].y));
self.ctx.lineTo(Math.round(p.x), Math.round(p.y));
self.ctx.closePath();
self.ctx.strokeStyle = 'hsla('+p.hue+', 100%, '+p.brightness+'%, '+p.alpha+')';
self.ctx.stroke();
if(self.flickerDensity 0){
var inverseDensity = 50 - self.flickerDensity;
if(rand(0, inverseDensity) === inverseDensity){
self.ctx.beginPath();
self.ctx.arc(Math.round(p.x), Math.round(p.y), rand(p.lineWidth,p.lineWidth+3)/2, 0, Math.PI*2, false)
self.ctx.closePath();
var randAlpha = rand(50,100)/100;
self.ctx.fillStyle = 'hsla('+p.hue+', 100%, '+p.brightness+'%, '+randAlpha+')';
self.ctx.fill();
}
}
};
};
self.createFireworks = function(startX, startY, targetX, targetY){
var newFirework = {
x: startX,
y: startY,
startX: startX,
startY: startY,
hitX: false,
hitY: false,
coordLast: [
{x: startX, y: startY},
{x: startX, y: startY},
{x: startX, y: startY}
],
targetX: targetX,
targetY: targetY,
speed: self.fworkSpeed,
angle: Math.atan2(targetY - startY, targetX - startX),
shockwaveAngle: Math.atan2(targetY - startY, targetX - startX)+(90*(Math.PI/180)),
acceleration: self.fworkAccel/100,
hue: self.currentHue,
brightness: rand(50, 80),
alpha: rand(50,100)/100,
lineWidth: self.lineWidth
};
self.fireworks.push(newFirework);
};
self.updateFireworks = function(){
var i = self.fireworks.length;
while(i--){
var f = self.fireworks[i];
self.ctx.lineWidth = f.lineWidth;
vx = Math.cos(f.angle) * f.speed,
vy = Math.sin(f.angle) * f.speed;
f.speed *= 1 + f.acceleration;
f.coordLast[2].x = f.coordLast[1].x;
f.coordLast[2].y = f.coordLast[1].y;
f.coordLast[1].x = f.coordLast[0].x;
f.coordLast[1].y = f.coordLast[0].y;
f.coordLast[0].x = f.x;
f.coordLast[0].y = f.y;
if(f.startX = f.targetX){
if(f.x + vx = f.targetX){
f.x = f.targetX;
f.hitX = true;
} else {
f.x += vx;
}
} else {
if(f.x + vx = f.targetX){
f.x = f.targetX;
f.hitX = true;
} else {
f.x += vx;
}
}
if(f.startY = f.targetY){
if(f.y + vy = f.targetY){
f.y = f.targetY;
f.hitY = true;
} else {
f.y += vy;
}
} else {
if(f.y + vy = f.targetY){
f.y = f.targetY;
f.hitY = true;
} else {
f.y += vy;
}
}
if(f.hitX f.hitY){
self.createParticles(f.targetX, f.targetY, f.hue);
self.fireworks.splice(i, 1);
}
};
};
self.drawFireworks = function(){
var i = self.fireworks.length;
self.ctx.globalCompositeOperation = 'lighter';
while(i--){
var f = self.fireworks[i];
self.ctx.lineWidth = f.lineWidth;
var coordRand = (rand(1,3)-1);
self.ctx.beginPath();
self.ctx.moveTo(Math.round(f.coordLast[coordRand].x), Math.round(f.coordLast[coordRand].y));
self.ctx.lineTo(Math.round(f.x), Math.round(f.y));
self.ctx.closePath();
self.ctx.strokeStyle = 'hsla('+f.hue+', 100%, '+f.brightness+'%, '+f.alpha+')';
self.ctx.stroke();
if(self.showTarget){
self.ctx.save();
self.ctx.beginPath();
self.ctx.arc(Math.round(f.targetX), Math.round(f.targetY), rand(1,8), 0, Math.PI*2, false)
self.ctx.closePath();
self.ctx.lineWidth = 1;
self.ctx.stroke();
self.ctx.restore();
}
if(self.showShockwave){
self.ctx.save();
self.ctx.translate(Math.round(f.x), Math.round(f.y));
self.ctx.rotate(f.shockwaveAngle);
self.ctx.beginPath();
self.ctx.arc(0, 0, 1*(f.speed/5), 0, Math.PI, true);
self.ctx.strokeStyle = 'hsla('+f.hue+', 100%, '+f.brightness+'%, '+rand(25, 60)/100+')';
self.ctx.lineWidth = f.lineWidth;
self.ctx.stroke();
self.ctx.restore();
}
};
};
self.bindEvents = function(){
$(window).on('resize', function(){
clearTimeout(self.timeout);
self.timeout = setTimeout(function() {
self.canvas.width = self.cw = $(window).innerWidth();
self.canvas.height = self.ch = $(window).innerHeight();
self.ctx.lineCap = 'round';
self.ctx.lineJoin = 'round';
}, 100);
});
$(self.canvas).on('mousedown', function(e){
self.mx = e.pageX - self.canvas.offsetLeft;
self.my = e.pageY - self.canvas.offsetTop;
self.currentHue = rand(self.hueMin, self.hueMax);
self.createFireworks(self.cw/2, self.ch, self.mx, self.my);
$(self.canvas).on('mousemove.fireworks', function(e){
self.mx = e.pageX - self.canvas.offsetLeft;
self.my = e.pageY - self.canvas.offsetTop;
self.currentHue = rand(self.hueMin, self.hueMax);
self.createFireworks(self.cw/2, self.ch, self.mx, self.my);
});
});
$(self.canvas).on('mouseup', function(e){
$(self.canvas).off('mousemove.fireworks');
});
}
self.clear = function(){
self.particles = [];
self.fireworks = [];
self.ctx.clearRect(0, 0, self.cw, self.ch);
};
self.canvasLoop = function(){
requestAnimFrame(self.canvasLoop, self.canvas);
self.ctx.globalCompositeOperation = 'destination-out';
self.ctx.fillStyle = 'rgba(0,0,0,'+self.clearAlpha/100+')';
self.ctx.fillRect(0,0,self.cw,self.ch);
self.updateFireworks();
self.updateParticles();
self.drawFireworks();
self.drawParticles();
};
self.init();
}
var fworks = new Fireworks();
});
/script
script type="text/javascript"
$(document).ready(function() {
setTimeout(function() {
$("#header").hide("slow");
},2000);
});
/script
/body
/html
asp.net怎样在页面上实现放烟花的效果
窗口效果
这个太简单了。。是用javascript结合CSS实现。。
如果你懂这两样的话。。我就把大概的原理给你说一下。。
那个登录框先做好。。在页面设置它的DIV属性display是none,z-index值为99(不过百度可是没有这么做,在本身的页面没有这个,而是通过AJAX技术加载的),然后通过那个登陆链接点击后通过JS设置它的display属性为block,然后还创建一个DIV层它的z-index值为77(比99小就行了),它的宽设置为100%,高设置为100%,透明度设置为50%。。如果此就可以做到了。。
dw的代码能用QQ空间的装扮吗?
一、登录你的QQ空间;dw的代码能用QQ空间的装扮
二、点“装扮空间”;
三、将以上QQ空间免费皮肤对应的代码粘贴到浏览器的地址栏(也就是输入网址的地方),如下图:
四、在地址栏里按回车,如果没有出现免费物品,请多按几次回车;
五、点“保存装扮方案”。
六、刷新页面(按f5)或者重新进你的qq空间
看看是不是有了免费物品或者免费皮肤了?
QQ空间免费flash漂浮物代码
迎新春(放礼花) javascript:window.top.space_addItem(16,23736,330,80,600,600,0);
鼠迎新岁 javascript:window.top.space_addItem(16,23727,330,80,600,600,0);
下雪了javascript:window.top.space_addItem(16,23699,330,80,600,600,0);
流动的时间 javascript:window.top.space_addItem(16,23693,330,80,600,600,0);
风之童话 javascript:window.top.space_addItem(16,23692,330,80,600,600,0);
LOVE DAY javascript:window.top.space_addItem(16,23725,330,80,600,600,0);
情人结javascript:window.top.space_addItem(16,23731,330,80,600,600,0);
五彩世界 javascript:window.top.space_addItem(16,23734,330,80,600,600,0);
梦的希望 javascript:window.top.space_addItem(5,609,0,0,1,1,0);
爱情天使 javascript:window.top.space_addItem(5,1097,0,0,1,1,0);
漂流瓶 javascript:window.top.space_addItem(16,22101,300,80,500,500,0);
菊花台 javascript:window.top.space_addItem(16,22099,300,80,500,500,0);
奇幻花园 javascript:window.top.space_addItem(16,22103,300,80,500,500,0);
做我自己 javascript:window.top.space_addItem(16,22105,300,80,500,500,0);
个性公主 javascript:window.top.space_addItem(16,22097,50,80,250,250,0);
悠扬芭蕾舞 javascript:window.top.space_addItem(16,23238,330,80,600,600,0);
心左至右 javascript:window.top.space_addItem(16,23236,330,80,600,600,0);
梦幻可爱 哎你双心 javascript:window.top.space_addItem(16,23226,330,80,600,600,0);
两只小猴子 javascript:window.top.space_addItem(16,23228,330,80,600,600,0);
下雪 javascript:window.top.space_addItem(16,23230,330,80,600,600,0);
下星星 javascript:window.top.space_addItem(16,23232,50,80,620,350,0);
雪右至左 javascript:window.top.space_addItem(16,23214,350,80,500,600,0);
下雪了 javascript:window.top.space_addItem(16,23699,330,80,600,600,0);
雪绒花 javascript:window.top.space_addItem(16,23699,330,80,600,600,0);
漂浮上升红色雪花 javascript:window.top.space_addItem(16,23732,350,80,500,600,0);
214我爱你 流星 javascript:window.top.space_addItem(16,23725,350,80,500,600,0);
四散黄点 javascript:window.top.space_addItem(16,23212,330,80,600,600,0);
彩色圆点上升 javascript:window.top.space_addItem(16,23734,350,80,500,600,0);
黑蝶 javascript:window.top.space_addItem(16,23234,50,80,620,350,0);
红色烟花 javascript:window.top.space_addItem(16,23736,150,80,620,350,0);
QQ空间免费欢迎动画代码
流星蝴蝶 javascript:window.top.space_addItem(14,7983,0,0,1,1,0);
欢迎来我家 javascript:window.top.space_addItem(14,4386,0,0,1,1,0);
幽夜幕 javascript:window.top.space_addItem(14,5002,0,0,1,1,0);
与你分享 javascript:window.top.space_addItem(14,4387,0,0,1,1,0);
月光马 javascript:window.top.space_addItem(14,5077,0,0,1,1,0);
分享 javascript:window.top.space_addItem(14,5329,0,0,1,1,0);
与你分享 javascript:window.top.space_addItem(14,4387,0,0,1,1,0);
世界杯 javascript:window.top.space_addItem(14,5242,0,0,1,1,0);
QQ空间免费导航代码
横向:粉色可爱 javascript:window.top.space_addItem(13,5503,0,0,600,200,0);
竖着的五星:jjavascript:window.top.space_addItem(13,5145,0,0,200,600,0);
美妙音符:javascript:window.top.space_addItem(13,5330,0,0,200,600,0);
鱼:javascript:window.top.space_addItem(13,5003,0,0,200,600,0);
清甜爽口:javascript:window.top.space_addItem(13,4384,0,0,150,700,0);
流金岁月:javascript:window.top.space_addItem(13,5330,0,0,150,700,0);
摘星:javascript:window.top.space_addItem(13,5145,0,0,150,700,0); wtto.net
深海奥妙:javascript:window.top.space_addItem(13,5003,0,0,150,700,0);
竖着的导航:javascript:window.top.space_addItem(13,1,100,80,0,0,94);
心爱花藤:javascript:window.top.space_addItem(13,9114,0,0,200,600,0);
横项的导航:javascript:window.top.space_addItem(13,5503,0,0,600
QQ空间免费音乐播放器代码:
第一款、Blue QQ空间音乐播放器
代码:javascript:window.top.space_addItem(6,676,0,0,200,200,0);
第二款、旋律 QQ空间免费播放器
代码:javascript:window.top.space_addItem(6,1228,0,0,200,200,0);
第三款、茶色 qq空间音乐播放器代码
代码:javascript:window.top.space_addItem(6,702,0,0,200,200,0);
第四款、水晶年代 qq空间音乐播放器代码
代码:javascript:window.top.space_addItem(6,703,0,0,200,200,0);
QQ空间添加背景音乐教程
首先打开QQ空间 点击音乐盒:
然后点右边的 添加背景音乐
再点 添加网络音乐
然后 把QQ空间最小化 打开百度mp3下载页面
依次点击我用红圈圈的图标
选中搜索的格式是mp3 填写要搜索的歌曲名字 然后敲回车Enter
然后点 试听
然后点 复制链接
然后 点开 刚才被最小化的 QQ空间 在歌曲链接里 右击 粘贴 把歌曲名 歌手名
都填写上 点 添加
然后 再点 将这首网络歌曲设为背景音乐 按F 5刷新 就 哦了 大功告成
各位大神们,用javascriptr如何编出让烟花炸开后显示出某个字?比如“爱”等。
哎呦,
现在的时代,
已经摒弃了虚拟的虚张声势,
要来真格的啦!!
请在百度网站,知道栏目,检索关键词:
历来的传统、行规,
展出的样品,
都是,不装填化学材料的空筒。
你们应当,
看心情哦,
凭借感觉啊,
看现场气氛了,
依据情绪变化啦,
编一个鼠标点击放烟花的程序
楼上的不对,,,晕,,乱来。
把这个文件下下来。,把下面的代码加到你网页下,注意jhanabi.class的路径和网页一个路径的下面就不用改了。
applet height=330 width=800 align=middle code=jhanabi.class
param name="para_bits" value="10000"
param name="para_max" value="150"
param name="para_blendx" value="50"
param name="para_blendy" value="50"
param name="para_sound" value="2"
param name="width" value="800"
param name="align" value="baseline"
param name="code" value="jhanabi.class"
param name="codeBase" value="./"
param name="height" value="330"
/applet
当前文章:烟花javascript,烟花视频
链接URL:http://azwzsj.com/article/dsiojdi.html