Blog Stats
Posts - 53
Articles - 4
Comments - 59
Trackbacks - 0
News
我使用新博客啦:
http://www.linjunhai.com/
大家到我的新博客上看看吧!
隨筆分類
(28)
JAVA天地(17)
其它相關(11)
文章分類
(4)
心情日志(4)
隨筆檔案
(53)
2011年5月 (2)
2011年4月 (1)
2011年3月 (1)
2010年12月 (1)
2010年9月 (1)
2010年8月 (1)
2010年5月 (1)
2010年3月 (1)
2009年11月 (1)
2009年10月 (1)
2009年7月 (1)
2009年5月 (2)
2009年1月 (2)
2008年12月 (11)
2008年11月 (2)
2008年10月 (1)
2008年9月 (1)
2008年7月 (3)
2008年6月 (1)
2007年10月 (1)
2007年8月 (1)
2007年7月 (3)
2007年4月 (1)
2007年3月 (3)
2006年12月 (4)
2006年11月 (5)
文章檔案
(4)
2007年5月 (2)
2007年4月 (2)
相冊
我的相冊
相關鏈接
Alvin's Blog
我現在使用的新博客.
CSS3 中文手冊
簡單實用的在線 CSS3 中文手冊
Scripts 學盟
不再悲催,體驗編寫腳本的樂趣!
給我留言
BlogJava 的留言板不用了, 用這個啦.
林俊海的博客
超級大菜鳥,每天要自強!
寫了個 JavaScript 煙花
在 CSDN 看到个 "【编程游戏】贺岁放礼花" 的 JavaScript 活动。
http://topic.csdn.net/u/20090104/17/db61e39c-7aed-46e0-8a0f-b571497f087c.html
看了人家好多个漂亮的作品,自己也想练练。
胡乱写了一个简单点的,投上去。当是记录自己的学习历程。
“
【编程游戏】贺岁放礼花。(点燃续帖2-8楼wcwtitxu的焰火)
” 就是我投的。
运行起来,执行效率较低。还得多学学...
效果预览
代码如下:
<html> <head><title>新年快樂 萬事如意</title> <style> body{ background:#000; padding:0; margin:0; overflow:hidden; } .ptr{ width:2px; height:2px; overflow:hidden; position: absolute; } </style> <script> function setColor(p) { p.r=Math.floor(p.r/2); p.g=Math.floor(p.g/2); p.b=Math.floor(p.b/2); if (p.r==0 && p.g==0 && p.b==0) return document.body.removeChild(p.ptr); p.ptr.style.background = "rgb("+p.r+","+p.g+","+p.b+")"; setTimeout(function(){setColor(p);}, 150); } function Point(x, y, r, g, b) { this.ptr = document.createElement("DIV"); this.ptr.className = "ptr"; document.body.appendChild(this.ptr); this.ptr.style.left = x + "px"; this.ptr.style.top = y + "px"; this.r = 2*r; this.g = 2*g; this.b = 2*b; var p = this; setTimeout(function(){setColor(p)}, Math.random()*200); } function Firework(mx, my) { this.mx = mx; this.my = my; this.cy=document.body.clientHeight||document.documentElement.clientHeight; } Firework.prototype.fire = function() { if (this.cy <= this.my) return this.expansion(); new Point(this.mx, this.cy, 0x40, 0x40, 0x40); this.cy -= 10; var self = this; setTimeout(function(){self.fire();}, 50); }; Firework.prototype.init = function() { this.fs = []; var r1 = Math.random()*256; var g1 = Math.random()*256; var b1 = Math.random()*256; for (var x=0; x<20; x++) { var o = {r:r1,g:g1,b:b1}; var d = Math.random() * 6.283; var d1 = Math.random(); o.vx = Math.sin(d) * d1 * 8; o.vy = Math.cos(d) * d1 * 8; o.l = Math.floor(Math.random() * 5) + 5; this.fs[x] = o; o.x = this.mx; o.y = this.my; } }; Firework.prototype.expansion = function() { if (!this.fs) this.init(); for (var x=0; x<20; x++) { var o = this.fs[x]; if (o===null) continue; if (o.l < 0) { this.fs[x] = null; continue; } o.vy += 0.03; o.x += o.vx; o.y += o.vy; o.l -= 1; new Point(o.x, o.y, o.r, o.g, o.b); } var me = this; setTimeout(function() { me.expansion(); }, 100); }; window.onload = function() { if (Math.random() < 0.3) { var h=document.body.clientHeight||document.documentElement.clientHeight; var w=document.body.clientWidth||document.documentElement.clientWidth; new Firework(0.2*w+0.6*w*Math.random(),h/2+30-h/2*Math.random()).fire(); } setTimeout(arguments.callee, 500); }; </script></head><body></body></html>
posted on 2009-01-05 17:40
林俊海
閱讀(132)
評論(0)
編輯
收藏
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
Powered by:
.Text
and
ASP.NET
- Copyright © 林俊海
主站蜘蛛池模板:
免费观看国产精品
|
免费电视剧在线观看
|
四虎永久在线免费观看
|
久久精品国产亚洲AV天海翼
|
成年女人永久免费观看片
|
亚洲成在人线aⅴ免费毛片
|
国产一级淫片a视频免费观看
|
污视频网站在线观看免费
|
亚洲欧洲自拍拍偷精品 美利坚
|
一级中文字幕乱码免费
|
亚洲精品无码午夜福利中文字幕
|
黄网站色视频免费在线观看的a站最新
|
久久久青草青青亚洲国产免观
|
亚洲a视频在线观看
|
在线a人片天堂免费观看高清
|
久久久久亚洲国产AV麻豆
|
五月天婷亚洲天综合网精品偷
|
www免费插插视频
|
亚洲国产精品免费视频
|
免费a级毛片高清视频不卡
|
亚洲Av无码乱码在线观看性色
|
国产黄色片在线免费观看
|
在线观看亚洲视频
|
国产亚洲精品自在久久
|
中文字幕在线免费观看
|
亚洲精品无码不卡在线播放
|
亚洲无码日韩精品第一页
|
亚洲精品免费观看
|
亚洲偷自拍另类图片二区
|
暖暖免费日本在线中文
|
久久久www成人免费毛片
|
超pen个人视频国产免费观看
|
亚洲国产电影av在线网址
|
a级毛片在线视频免费观看
|
亚洲丝袜中文字幕
|
亚洲精品和日本精品
|
91人人区免费区人人
|
日韩精品无码免费视频
|
亚洲视频在线观看视频
|
国产极品美女高潮抽搐免费网站
|
毛片在线全部免费观看
|