[Programming Game] presents a gift at the age of a new year. (Ignition of zswang fireworks on the 1-188th floor)
Source: Internet
Author: User
[Programming Game] presents a gift at the age of a new year. (The first prize is 10000 available points)
Author:
Ignition[Ctrl + A select all tips: you can modify some code and then press run]
<HTML> <br/> <pead> <title> -- 2009 cleaner version </title> </pead> <br/> <body style = "overflow: hidden; background-color: black; "> <br/> </body> <br/> <SCRIPT type =" text/JavaScript "> <br/> function hsl2color (HSL) {<br/> If (HSL. h> 360 | HSL. h <0 | HSL. s> 100 | HSL. S <0 | HSL. l> 100 | HSL. L <0) <br/> return "#000000"; <br/> var RGB = {R: 0, G: 0, B: 0 }; <br/> If (HSL. h <= 60) {<br/> RGB. R = 255; <br/> RGB. G = m Ath. floor (255/60 * HSL. h); <br/>} else if (HSL. h <= 120) {<br/> RGB. R = math. floor (255-(255/60) * (HSL. h-60); <br/> RGB. G = 255; <br/>} else if (HSL. h <= 180) {<br/> RGB. G = 255; <br/> RGB. B = math. floor (255/60) * (HSL. h-120); <br/>} else if (HSL. h <= 240) {<br/> RGB. G = math. floor (255-(255/60) * (HSL. h-180); <br/> RGB. B = 255; <br/>} else if (HSL. h <= 300) {<br/> RGB. R = math. f Loor (255/60) * (HSL. h-240); <br/> RGB. B = 255; <br/>} else if (HSL. h <= 360) {<br/> RGB. R = 255; <br/> RGB. B = math. floor (255-(255/60) * (HSL. h-300); <br/>}< br/> var sat = math. ABS (HSL. s-100)/100); <br/> RGB. R = math. floor (RGB. r-(RGB. r-128) * SAT); <br/> RGB. G = math. floor (RGB. g-(RGB. g-128) * SAT); <br/> RGB. B = math. floor (RGB. b-(RGB. b-128) * SAT); <br/> var Lum = (HSL. l- 50)/50; <br/> If (Lum> 0) {<br/> RGB. R = math. floor (RGB. R + (255-RGB. r) * Lum); <br/> RGB. G = math. floor (RGB. G + (255-RGB. g) * Lum); <br/> RGB. B = math. floor (RGB. B + (255-RGB. b) * Lum); <br/>} else if (Lum <0) {<br/> RGB. R = math. floor (RGB. R + RGB. R * Lum); <br/> RGB. G = math. floor (RGB. G + RGB. g * Lum); <br/> RGB. B = math. floor (RGB. B + RGB. B * Lum); <br/>}< br/> return "#" + ("00000" + (RGB. R * 256*256 + RGB. g * 256 + RGB. B ). tostring (16 )). replace (/^. *(. {6 }$)/g, "$1"); <br/>}</P> <p> function ball (parent, text) {<br/> This. parent = parent; <br/> This. TEXT = text; <br/> This. visible = true; <br/> This. SPAN = document. createelement ("span"); <br/> This. span. innerhtml = This. text; <br/> This. span. style. position = "absolute"; <br/>}</P> <p> ball. prototype. update = function (color, X, Y, size, Alpha, Speed, fire) {<br/> This. fire = fire; <br/> This. alpha = Alpha; <br/> This. speed = speed; <br/> This. gravity = 0; <br/> This. X = x; <br/> This. y = y; <br/> This. color = color; <br/> This. HSL = {H: color, S: 100, L: 80 };< br/> This. size = size; <br/> This. dochange (); <br/>}</P> <p> ball. prototype. dochange = function () {<br/> with (this. span. style) {<br/> fontsize = This. size + "PX"; <br/> left = This. X + "PX"; <Br/> Top = This. Y + "PX"; <br/> color = hsl2color (this. HSL); <br/>}< br/> If (! This. span. parent) This. parent. insertbefore (this. SPAN, this. parent. firstchild); <br/>}</P> <p> ball. prototype. move = function () {<br/> This. X = math. cos (this. alpha) * This. speed + this. x; <br/> This. y = math. sin (this. alpha) * This. speed + this. y; <br/> This. y = This. gravity + this. y; <br/> This. gravity ++ = 0.05; <br/> This. HSL. l-= This. fire; <br/> This. dochange (); <br/>}</P> <p> ball. prototype. hide = functio N () {<br/> If (! This. visible) return; <br/> This. visible = false; <br/> This. span. style. display = "NONE"; <br/>}</P> <p> ball. prototype. show = function () {<br/> If (this. visible) return; <br/> This. visible = true; <br/> This. span. style. display = "Block"; <br/>}</P> <p> ball. prototype. dispose = function () {<br/> This. disposing = true; <br/> for (var I in this) {<br/> if (I = "parent") continue; <br/> If (typeof this [I]. di Spose = "function "&&! This [I]. disposing) This [I]. dispose (); <br/> If (typeof this [I]. parentnode = "object") <br/> This [I]. parentnode. removechild (this [I]); <br/> Delete this [I]; <br/>}</P> <p> function firework (parent, text, size, Count, speed) {<br/> This. parent = parent; <br/> This. speed = speed; <br/> This. size = size; <br/> This. total = 0; <br/> This. active = false; <br/> This. bils = new array (count); <br/> for (VA R I = 0; I <this. bils. length; I ++) {<br/> This. bils [I] = new ball (parent, text); <br/> This. bils [I]. firework = This; <br/> This. bils [I]. index = I; <br/> This. bils [I]. hide (); <br/>}</P> <p> firework. prototype. tick = function () {<br/> This. total ++; <br/> If (typeof this. ontick = "function") This. ontick (this); <br/> for (VAR I = 0; I <this. bils. length; I ++) {<br/> If (! This. bils [I]. visible) continue; <br/> If (typeof this. onballmove = "function") <br/> This. onballmove (this. bils [I]); <br/> else this. bils [I]. move (); <br/>}< br/> var self = This; <br/> This. timer = setTimeout (function () {self. tick () ;}, 10); <br/>}</P> <p> firework. prototype. stop = function () {<br/> If (! This. active) return; <br/> This. active = false; <br/> cleartimeout (this. timer); <br/> for (VAR I = 0; I <this. bils. length; I ++) <br/> This. bils [I]. hide (); <br/> If (typeof this. onstop = "function") This. onstop (this); <br/>}</P> <p> firework. prototype. replay = function () {<br/> This. stop (); <br/> This. active = true; <br/> This. selected =-1; <br/> This. total = 0; <br/> This. tick (); <br/> If (typeof this. ONR Eplay = "function") This. onreplay (this); <br/>}</P> <p> var firework = new firework (document. body, "●", 32, 15, 7.5); <br/> firework. alpha = 0.5-math. random (); <br/> firework. offset = math. random () <0.5? + 1:-1; <br/> firework. ontick = function () {<br/> If (this. total % 10 = 0) {<br/> var H = document. body. clientheight | document.doc umentelement. clientheight; <br/> var W = document. body. clientwidth | document.doc umentelement. clientwidth; <br/> This. selected = (this. selected + 1) % This. bils. length; <br/> var alpha = This. alpha + 1/This. bils. length * This. offset; <br/> If (alpha <-0.5 | alpha> 0.5) This. offset =-this. offset; <br/> This. alpha = Alpha; <br/> This. bils [this. selected]. update (<br/> typeof this. color = "undefined "? Math. random () * 360: This. color, <br/> W/2, H, <br/> This. size, math. pI * 1.5 + this. alpha * 2, this. speed, 0.5 <br/>); <br/> This. bils [this. selected]. show (); <br/>}< br/> firework. replay (); </P> <p> var firework2 = new firework (document. body, "●", 15, 20, 12.5); <br/> firework2.ontick = function () {<br/> If (this. total % 50 = 0) {<br/> var H = document. body. clientheight | document.doc umente LEMENT. clientheight; <br/> var W = document. body. clientwidth | document.doc umentelement. clientwidth; <br/> var ball = firework. bils [math. floor (firework. selected + firework. bils. length/2) % firework. bils. length]; <br/> If (! Ball |! Ball. visible) return; <br/> ball. hide (); <br/> for (VAR I = 0; I <this. bils. length; I ++) {<br/> This. bils [I]. update (<br/> ball. color, <br/> ball. x, ball. y, this. size, 2 * Math. pI * Math. random (), math. random () * This. speed, 1.5); <br/> This. bils [I]. show (); <br/>}< br/> firework2.replay (); <br/> </SCRIPT> <br/> </ptml>
Ignition[Ctrl + A select all tips: you can modify some code and then press run]
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.