【编程游戏】贺岁放礼花。(点燃续帖1-36楼cgisir的焰火)

<script type="text/javascript"> function viewPage(html) { var page = window.open('', '', ''); page.opener = null; page.document.write(html); page.document.close(); } </script> 【编程游戏】贺岁放礼花。(第一名奖励10000可用分)
作者: avatar
点燃[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行] <iframe src="http://vote.youkuaiyun.com/VotePostSimple.aspx?voteid=820" marginheight="0" marginwidth="0" scrolling="no" width="100%" frameborder="0" height="400"></iframe> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>烟火</title> <style> html{height:100%; overflow:hidden} body{background:black; height:100%} div{position:absolute; overflow:hidden; font-size:6px; Arial, Helvetica, sans-serif; color:yellow} </style> <script> var Browser ={ IE: !!(window.attachEvent && !window.opera), Opera: !!window.opera, WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1, Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1, MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/) } Object.extend = function(destination, source) { for (var property in source) destination[property] = source[property]; return destination; } var Element = { setOpacity: function(val){ if(Browser.IE){ this.style.filter = 'alpha(opacity='+val+')'; }else{ this.style.opacity = parseFloat(val/100); } } } //var m=1, ms=12, r = 1; function start(pos){ var angel = pos.m&1 && 60 || 120; for(var i=0; i<3; i++){ angel += 120; createStart({x:pos.x, y:pos.y, r:pos.r, angel: angel, m:pos.m, c:pos.c}); } pos.m++ if(pos.m>pos.ms) return; var o = arguments.callee; setTimeout(function(){o(pos)},10); } function createStart(pos){ var d = document.createElement('div'); Object.extend(d, Element); //d.innerHTML = pos.m&1&&'1'||'0'; d.innerHTML = '●'; d.style.color = colors[Math.floor(Math.random()*7)]; //d.style.color = pos.c; d.style.left = pos.x - parseInt(pos.r*Math.sin(pos.angel*2*Math.PI/360)) + 'px'; d.style.top = pos.y - parseInt(pos.r*Math.cos(pos.angel*2*Math.PI/360)) + 'px'; document.body.appendChild(d); d.n = 1+pos.m*1.6; d.o = 150; d.op = d.o/d.n; d.play = function(pos){ this.n--; pos.r += this.n/0.5; pos.y -= this.n-12; d.style.left = pos.x - parseInt(pos.r*Math.sin(pos.angel*2*Math.PI/360)) + 'px'; d.style.top = pos.y - parseInt(pos.r*Math.cos(pos.angel*2*Math.PI/360)) + 'px'; this.o = this.o - this.op; this.setOpacity(this.o); if(this.n<=0){ clearInterval(this.t); document.body.removeChild(this); } } pos.m *= 5; d.t = setInterval(function(){d.play.call(d,pos)}, 5+pos.m); } function bp(){ var x = document.documentElement.scrollWidth, y = document.documentElement.scrollHeight; var d = document.createElement('div'); d.innerHTML = '↑'; d.style.fontSize=12; d.style.color = colors[Math.floor(Math.random()*6)]; d.h = y; d.e = Math.floor(Math.random()*300) d.s = 30; d.style.top = y + 'px'; d.style.left = Math.floor(Math.random()*x) + 'px'; document.body.appendChild(d); d.t = setInterval(function(){re(d)}, 25) } function re(o,par){ o.s<=10?o.s=10:o.s--; o.style.top = o.offsetTop - o.s*1.5 + 'px' if(o.offsetTop < o.h/2-o.e){ clearInterval(o.t); start({m:1, ms:8, r:1, x:o.offsetLeft, y:o.offsetTop, c:o.style.color}); document.body.removeChild(o); } } var colors = ['red','yellow','blue', 'white', '#f36','#0f9']; onload = function(){ setInterval(bp, 1500); } </script> </head> <body> <div style="z-index:999; border:1px solid #666; height:118px; width:500px; left:50%; top:50%; margin-left:-250px; margin-top:-58px; text-align:center; font-size:35px; line-height:118px; font-weight:bold; color:red"> 新年快乐! 万事如意! </div> </body> </html>
点燃[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值