[Programming Game] presents a gift at the age of a new year. (Ignition of zjsfdxbao on the 34 th 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> <br/> <title> [programming Game] Lihua, a New Year's Eve. </Title> <br/> </pead> <br/> <body> <br/> <SCRIPT> <br/> var firecolor = ["red ", "Blue", "yellow", "orange", "pink"]; <br/> var firestyle = ["yellow", "●", "○ ", "◎", "▲"]; <br/> var starstyle = [" ☆ ","★"," ※", "Medium", "◆"]; <br/> function XO () <br/>{< br/> This. X = 0; this. y = 0; this. power = math. floor (math. random () * arguments [0] + arguments [1]); <br/>}< br/> function Star (c) <br/>{< br/> var handle = This; <br/> Xo. call (this, 100,0); <br/> This. star = starstyle [math. floor (math. random () * 4)]; <br/> This. angle = 2 * Math. pI * Math. random () + 1; <br/> This. O = document. createelement ("span"); <br/> document. body. appendchild (this. o); <br/> This. o. innerhtml = This. star; <br/> This. style = This. o. style; <br/> This. color = C; <br/> This. exist = false; <br/> with (this. style) <br/>{< br/> visibility = "hidden"; <br/> position = "absolute"; <br/> color = This. color; <br/>}< br/> This. move = function () <br/>{< br/> If (this. Y <this. power) <br/>{< br/> This. Y + = 2; <br/> with (this. style) <br/> {<br/> Top = This. y; <br/> left = This. X + this. y * Math. sin (this. angle); <br/>}< br/>}else <br/>{< br/> This. clear (); <br/>}< br/> This. burn = function (x, y) <br/>{< br/> This. style. left = This. X = x; <br/> This. style. top = This. y = y; <br/>}< br/> This. shine = function (x, y) <br/>{< br/> This. burn (x, y); <br/> This. style. visibility = "visible"; <br/> This. gogo = setinterval (function () {handle. move ()}, 17); <br/>}< br/> This. clear = function () <br/>{< br/> This. o. parentnode. removechild (this. o); <br/> clearinterval (this. gogo); <br/>}< br/> function firework () <br/>{< br/> var handle = this; <br/> Xo. call (this, 10, 25); <br/> This. color = firecolor [math. floor (math. random () * 4)]; <br/> This. shape = firestyle [math. floor (math. random () * 4)]; <br/> This. starnum = math. floor (math. random () * 7) + 5; <br/> This. star = new array (); <br/> This. exist = true; <br/> for (VAR I = 0; I <this. starnum; I ++) <br/>{< br/> This. star [I] = New Star (this. color); <br/>}< br/> This. starnum = math. floor (math. random () * 4) + 4; <br/> This. O = document. createelement ("span"); <br/> document. body. appendchild (this. o); <br/> This. o. innerhtml = This. shape; <br/> This. style = This. o. style; <br/> This. style. color = This. color; <br/> This. style. position = "absolute"; <br/> This. setx = function (x) {This. style. left = x + "PX"; this. X = x ;}< br/> This. sety = function (y) {This. style. top = Y + "PX"; this. y = y ;}< br/> This. move = function () <br/>{< br/> This. y-= This. power/3; <br/> If (this. y> This. power) <br/> This. style. top = This. Y + "PX"; <br/> else <br/>{< br/> If (this. exist) This. clear (); <br/>}< br/> This. fire = function () <br/>{< br/> This. gogo = setinterval (function () {handle. move ()}, 17); <br/>}; <br/> This. clear = function () <br/>{< br/> This. o. parentnode. removechild (this. o); <br/> clearinterval (this. gogo); <br/> This. exist = false; <br/> for (VAR I = 0, j = This. star. length; I <j; I ++) <br/>{< br/> This. star [I]. shine (this. x, this. y); <br/>}< br/> function firescene (n) <br/>{< br/> This. num = N; <br/> This. scenewidth = document. body. clientwidth; <br/> This. sceneheight = document. body. clientheight; <br/> This. step = math. floor (this. scenewidth/This. num); <br/> This. firework = new array (); <br/> for (VAR I = 0; I <this. num; I ++) <br/>{< br/> This. firework [I] = new firework (); <br/> This. firework [I]. setx (this. step * I); <br/> This. firework [I]. sety (this. sceneHeight-50); <br/>}< br/> This. fire = function () <br/>{< br/> for (VAR I = 0, j = This. firework. length; I <j; I ++) <br/>{< br/> This. firework [I]. fire (); <br/>}< br/> window. onload = function () <br/>{< br/> document. body. style. backgroundcolor = "black"; <br/> New firescene (8 ). fire () <br/> setinterval ("New firescene (8 ). fire () ", 2000 ); <br/>}< br/> </SCRIPT> <br/> </body> <br/> </ptml> <br/>
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.