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
林俊海
閱讀(134)
評論(0)
編輯
收藏
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
Powered by:
.Text
and
ASP.NET
- Copyright © 林俊海
主站蜘蛛池模板:
精品亚洲成在人线AV无码
|
四虎影视精品永久免费网站
|
亚洲乱码中文字幕久久孕妇黑人
|
亚洲精品无码一区二区
|
成年美女黄网站18禁免费
|
成人片黄网站色大片免费
|
亚洲第一页在线视频
|
在线观看永久免费
|
337p日本欧洲亚洲大胆色噜噜
|
久久99热精品免费观看牛牛
|
亚洲成a人片77777kkkk
|
国产好大好硬好爽免费不卡
|
成年女人毛片免费播放人
|
国产成人精品日本亚洲直接
|
成人免费毛片内射美女APP
|
亚洲国产精品无码久久九九大片
|
亚洲午夜国产精品无码
|
热99RE久久精品这里都是精品免费
|
亚洲日韩欧洲乱码AV夜夜摸
|
a视频在线免费观看
|
亚洲精品美女在线观看
|
毛色毛片免费观看
|
全部在线播放免费毛片
|
国产亚洲综合色就色
|
在线视频精品免费
|
亚洲av成人无码网站…
|
亚洲一卡2卡4卡5卡6卡在线99
|
亚洲一区中文字幕在线电影网
|
成人免费在线视频
|
又大又硬又粗又黄的视频免费看
|
亚洲国产精品无码AAA片
|
大学生一级毛片免费看
|
一级毛片免费不卡
|
亚洲性色高清完整版在线观看
|
在线观看免费污视频
|
99久久免费国产精品热
|
亚洲不卡中文字幕
|
亚洲自偷自偷图片
|
免费看污成人午夜网站
|
成人免费网站久久久
|
亚洲色偷偷偷网站色偷一区
|