网站首页
网站导航
Ctrl+D收藏
首 页
代码段
源码包
文档库
工具箱
代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
JS
】
烟花特效
作者:
盈
/ 发布于
2014/10/10
/
424
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gbk" /> <title>JavaScript烟花</title> <script type="text/javascript"> var showcoo = function(){ this.size = 40; this.speed = 0.1; this.rise(); } showcoo.prototype = { color:function(){ var c = ['0','3','6','9','c','f']; var t = [c[Math.floor(Math.random()*100)%6],'0','f']; t.sort(function(){return Math.random()>0.5?-1:1;}); return '#'+t.join(''); }, aheight:function(){ var h = document.documentElement.clientHeight; return Math.abs(Math.floor(Math.random()*h-200))+201; }, firecracker:function(){ var b = document.createElement('div'); var w = document.body.clientWidth; b.style.color = this.color(); b.style.position = 'absolute'; b.style.bottom = 0; b.style.left = Math.floor(Math.random()*w)+1+'px'; document.body.appendChild(b); return b; }, rise:function(){ var o = this.firecracker(); var n = this.aheight(); var speed = this.speed; var e = this.expl; var s = this.size; var k = n; var m = function(){ o.style.bottom = parseFloat(o.style.bottom)+k*speed+'px'; k-=k*speed; if(k<2){ clearInterval(clear); e(o,n,s,speed); } } o.innerHTML = '*'; if(parseInt(o.style.bottom)<n){ var clear = setInterval(m,20); } }, expl:function(o,n,s,speed){ var R = n/3; var Ri = n/6; var r = 0; var ri = 0; for(var i=0;i<s;i++){ var span = document.createElement('span'); var p = document.createElement('p'); span.style.position = 'absolute'; span.style.left = 0; span.style.top = 0; span.innerHTML = '*'; p.style.position = 'absolute'; p.style.left = 0; p.style.top = 0; p.innerHTML = '+'; o.appendChild(span); o.appendChild(p); } function spr(){ r += R*speed; ri+= Ri*speed/2; sp = o.getElementsByTagName('span'); p = o.getElementsByTagName('p'); for(var i=0; i<sp.length;i++){ sp[i].style.left=r*Math.cos(360/s*i)+'px'; sp[i].style.top=r*Math.sin(360/s*i)+'px'; p[i].style.left=ri*Math.cos(360/s*i)+'px'; p[i].style.top=ri*Math.sin(360/s*i)+'px'; } R-=R*speed; if(R<2){ clearInterval(clearI); o.parentNode.removeChild(o); } } var clearI = setInterval(spr,20); } } window.onload = function(){ function happyNewYear(){ new showcoo(); } setInterval(happyNewYear,400); } </script> <style type="text/css"> </style> </head> <body style="background:#000;font:12px Arial"> </body> </html>
评论列表
本站所提供的代码,版权归原作者所有,若有侵犯作者版权,请与我们联系,我们将立即删除或修改。谢谢!
本站所有代码发布及提供者。
试试其它关键字
烟花特效
同语言下
.
Jquery搜索框获取回车事件
.
H5页面添加倒计时,然后自动跳转
.
通过user-agent判断h5页面是在哪个手机App(QQ、微信
.
nginx 禁止未绑定的域名访问
.
JavaScript 获取按键,并屏蔽系统 Window 事件
.
H5之只允许微信浏览器打开,禁止从外部浏览器访问
.
微信打开网址添加在浏览器中打开提示的办法
.
实现JS复制、粘贴,Chrome/Firefox下可用
.
video视频播放,play()、pause()、duration时长、onen
.
HTML5实现MP3上传前的预览和播放时长的获取
可能有用的
.
SQL查询 多列合并成一行用逗号隔开
.
一行一行读取txt的内容
.
C#动态修改文件夹名称(FSO实现,不移动文件)
.
c# 移动文件或文件夹
.
c#图片添加水印
.
Java PDF转换成图片并输出给前台展示
.
网站后台修改图片尺寸代码
.
处理大图片在缩略图时的展示
.
实现对图片上传的接收
.
判断用户输入的是否为IP地址
盈
贡献的其它代码
(
1
)
.
烟花特效
地图
本站
我们
服务
版权
联系
回馈
博客