[Programming Game] presents a gift at the age of a new year. (Ignment the fireworks of yvhkiawy on building 2-102)

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]

<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br/> <HTML xmlns = "http://www.w3.org/1999/xhtml"> <br/> <pead> <br/> <title> untitled page </title> <br/> <style type = "text/CSS"> <br/> body {margin: 0px; padding: 0px; width: 100%; Height: 100%; Background-color: #000000; color: # ffffff; overflow: hidden ;}< br/> Div {overflow: hidden; font-size: 10 p X ;} <br/> </style> <br/> </pead> <br/> <body> </P> <p> </body> <br/> <script type = "text/JavaScript"> <br/> function random (start, end) {If (START | End) return math. round (start + math. random () * (end-Start); else return math. random () ;}< br/> function sparks (point, Count, R, G, B, sky, n) <br/>{< br/> var da = math. pI * 2/count; <br/> var r = random (80,150); <br/> var step = random (5, 15 ); <br/> for (VAR I = 0; I <count; I ++) <B R/>{< br/> var ele = document. createelement ("Div"); <br/> ELE. innerhtml = "●"; <br/> ELE. style. color = "RGB (" + R + "," + G + "," + B + ")"; <br/> ELE. pos = function (point) {If (point) {This. style. left = point. X + "PX"; this. style. top = point. Y + "PX";} else {return new point (this. offsetleft, this. offsettop) ;}}; <br/> ELE. size = function (size) {If (size) {This. style. width = size. X + "PX"; This. style. height = size. Y + "PX"; this. style. fontsize = size. X + "PX";} else {return new point (this. offsetwidth, this. offsetheight) }}; <br/> ELE. OPAC = function (o) {This. style. opacity = (O/100); this. style. required opacity = o/100; this. style. khtmlopacity = o/100; this. style. filter = "alpha (opacity =" + O + ")" ;}; <br/> ELE. R = r; <br/> ELE. nstep = 0; <br/> ELE. step = step; <br/> ELE. D = da * I; <br/> ELE. spoint = poi NT; <br/> sky. appendchild (Ele); <br/> ELE. style. position = "absolute"; <br/> ELE. size (new point (10, 10); <br/> ELE. POs (new point (point. x-5, point. (y-5); <br/> ELE. run = function () {<br/> If (this. nstep> = This. step) {<br/> This. parentnode. removechild (this); return; <br/>}< br/> This. nstep ++; <br/> var Nr = (this. r/This. step) * This. nstep; <br/> This. POs (new point (NR * Math. cos (this. d) + this. SPO Int. x-5, NR * Math. sin (this. d) + this. spoint. y-5); <br/> If (this. nstep> = This. STEP/2) {<br/> var BL = 1-(this. nstep-this. STEP/2)/This. STEP/2; <br/> This. OPAC (math. round (100 * BL); <br/> var P = math. round (10 * BL); <br/> This. size (new point (p, p); <br/>}< br/> var OBJ = This; <br/> setTimeout (function () {obj. run ();}, 200); <br/>}< br/> ELE. run (); <br/>}< br/> If (! N) n = 0; <br/> N ++; <br/> If (n <random (1, 5) <br/> setTimeout (function () {New sparks (point, Count, R, G, B, sky, n) }, 300); <br/>}< br/> Function Point (x, y) {This. X = x; this. y = y ;}< br/> ({<br/> fire: function () {<br/> var r = random (0,255 ); vaR G = random (0,255); var B = random (0,255); <br/> var Pos = random (100, this. sky. width-100); <br/> New this. firework (R, G, B, POs, this. sky); var OBJ = This; setTimeout (function () {obj. fire () ;}, 1000) ;}, <br/> sky :( function () {<br/> var OBJ = document. body; <br/> obj.width?document.doc umentelement. clientwidth; <br/> obj.height?document.doc umentelement. clientheight; <br/> return OBJ; <br/>}) (), <br/> firework: function (R, G, B, position, Sky) <br/>{< br/> This. ele = document. createelement ("Div"); <br/> This. ele. style. position = "absolute"; <br/> This. sky = sky; <br/> This. color = {"R": R, "G": G, "B": B }; <br/> This. ele. pos = function (point) {If (point) {This. style. left = point. X + "PX"; this. style. top = point. Y + "PX";} else {return new point (this. offsetleft, this. offsettop) ;}}; <br/> // This. ele. size = function (size) {If (size) {This. style. width = size. X + "PX"; this. style. height = size. Y + "PX";} else {return new point (this. offsetwidth, this. offsetheight) }}; <br/> // This. ele. OPAC = function (o) {This. style. opacity = (O/100); this. style. required opacity = o/100; this. style. khtmlopacity = o/100; this. style. filter = "alpha (opacity =" + O + ")" ;}; <br/> This. flyh = This. sky. height-randdom (200, this. sky. height * 0.8); <br/> This. ele. POs (new point (position, this. sky. height-10); <br/> This. ele. style. backgroundcolor = "RGB (" + R + "," + G + "," + B + ")"; <br/> This. ele. style. width = "5px"; <br/> This. ele. style. height = "10px" <br/> document. body. appendchild (this. ele); <br/> This. fire = function () {If (this. ele. POs (). Y <= This. flyh) {New sparks (this. ele. POs (), random (5, 12), this. color. r, this. color. g, this. color. b, this. sky); this. ele. parentnode. removechild (this. ele); return;} var Pos = This. ele. POs (); this. ele. POs (new point (POS. x, POS. y-20); var OBJ = This; setTimeout (function () {obj. fire ();}, 100) ;}; <br/> This. fire (); <br/>}< br/> }). fire (); <br/> </SCRIPT> <br/> </ptml>
Ignition[Ctrl + A select all tips: you can modify some code and then press run]

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.