[Programming Game] presents a gift at the age of a new year. (Ignition of fireworks at kitegirl, building 1)

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> </title> <br/> </pead> <br/> <body bgcolor =" #000000 "text =" # ffffff "style =" overflow: hidden; "> <br/> <p id =" idinsertobject "> </P> <br/> </body> <br/> <SCRIPT type =" text/JavaScript "> <br/> function RGB (B, g, R) {<br/> return "#" + <br/> ("00" + math. floor (R ). tostring (16 )). replace (/^. * (/W {2} $)/g, "$1") + <br/> ("00" + math. floor (g ). tostring (16 )). replace (/^. * (/W {2} $)/g, "$1") + <br/> ("00" + math. floor (B ). tostring (16 )). replace (/^. * (/W {2} $)/g, "$1"); <br/>}< br/> function $ (ID) {return document. getelementbyid (ID) ;}</P> <p> var pubcellnumber = 0; <br/> var puborbits_x = new array (256*8 ); <br/> var puborbits_y = new array (256*8); </P> <p> var pubofflist = new array (256) <br/> var publimit_x = []; <br/> var publimit_y = [] <br/> var pubspanobjects = new array (256*8); <br/> var pubcolors = new array (256*8 ); <br/> var pubstepon = 0; <br/> var pubworkon = 0; <br/> var pubx = 0; <br/> var puby = 0; <br/> var pubscale = 0; <br/> var pubtime = 0; <br/> var pubcelllength = 0; <br/> var publightlength = 0; <br/> var pubspeed = 0; <br/> var pubglimit = 0; </P> <p> window. onload = function () {<br/> pubcelllength = 64; <br/> publightlength = 7; </P> <p> createobjects (pubcelllength, publightlength ); <br/> createcolors (); <br/> createlimits (); <br/> newskyrocket (); <br/> showskyrocket (); <br/>}</P> <p> function newskyrocket () {<br/> pubx = math. floor (math. random () * 640); <br/> puby = math. floor (math. random () * 480); <br/> pubscale = math. random () * 1 + 1; <br/> pubstepon = 10; <br/> for (VAR tindex = 0; tindex <= pubcelllength; tindex ++) {<br/> pubofflist [tindex] = math. floor (math. random () * 20) + 27; <br/>}< br/> cellsclear (); <br/> createcolors (); <br/> createlimits (); <br/> pubtime = setTimeout ("showskyrocket ();", 10); <br/>}</P> <p> function showskyrocket () {<br/> If (pubworkon <48) {<br/> pubworkon ++; <br/> If (pubspeed> 3) pubspeed = pubspeed-2; <br/> viewobjects (pubcelllength, publightlength, pubscale, pubx, puby); <br/> cellsmove (puborbits_x, puborbits_y, publimit_x, publimit_y, pubcelllength, publightlength, pubspeed ); <br/> pubtime = setTimeout ("showskyrocket ();", 1); <br/>}else {<br/> pubworkon = 0; <br/> pubspeed = 24; <br/> newskyrocket (); <br/>}</P> <p> function viewobjects (pcelllength, plightlength, pscale, PX, Py) {<br/> for (VAR tindex = 0; tindex <= pcelllength; tindex ++) {<br/> for (VAR tlight = 0; tlight <= plightlength; tlight ++) {<br/> with (pubspanobjects [tindex * 256 + tlight]. style) {<br/> If (pubworkon> pubofflist [tindex] + (plightlength-tlight) {<br/> color = RGB (0, 0, 0 ); <br/>} else {<br/> color = pubcolors [tindex * 256 + tlight]; <br/> Top = puborbits_y [tindex * 256 + tlight] * pubscale + py; <br/> left = puborbits_x [tindex * 256 + tlight] * pubscale + px; <br/>}</P> <p> function createobjects (pcelllength, plightlength) {<br/> for (VAR tindex = 0; tindex <= pcelllength; tindex ++) {<br/> for (VAR tlight = 0; tlight <= plightlength; tlight ++) {<br/> pubspanobjects [tindex * 256 + tlight] = document. createelement ("span"); <br/> with (pubspanobjects [tindex * 256 + tlight]) {<br/> innerhtml = "*"; <br/>}< br/> with (pubspanobjects [tindex * 256 + tlight]. style) {<br/> position = "absolute" <br/> color = RGB (0, 0, 0) <br/>}< br/> idinsertobject. appendchild (pubspanobjects [tindex * 256 + tlight]); <br/>}</P> <p> function createcolors () {<br/> var tcolor = new array (3); </P> <p> tcolor [0] = math. random (); <br/> tcolor [1] = math. random (); <br/> tcolor [2] = math. random (); <br/> tcolor [math. floor (math. random () * 3)] = 1; <br/> for (VAR tcolorindex = 0; tcolorindex <= pubcelllength; tcolorindex ++) {<br/> for (VAR tlightindex = 0; tlightindex <= publightlength; tlightindex ++) {<br/> tlightvalue = 255 * tlightindex/7; <br/> pubcolors [tcolorindex * 256 + tlightindex] = RGB (tcolor [0] * tlightvalue, tcolor [1] * tlightvalue, tcolor [2] * tlightvalue ); <br/>}</P> <p> function cellsclear () {<br/> for (VAR tcellindex = 0; tcellindex <= pubcelllength; tcellindex ++) {<br/> for (VAR tlightindex = 0; tlightindex <= publightlength; tlightindex ++) {<br/> puborbits_x [tcellindex * 256 + tlightindex] = 0; <br/> puborbits_y [tcellindex * 256 + tlightindex] = 0; <br/>}</P> <p> function cellsmove () {<br/> var pgdown = pubworkon/12; <br/> for (VAR tcellindex = 0; tcellindex <= pubcelllength; tcellindex ++) {<br/> for (VAR tlightindex = 0; tlightindex <publightlength; tlightindex ++) {<br/> puborbits_x [tcellindex * 256 + tlightindex] = puborbits_x [tcellindex * 256 + tlightindex + 1]; <br/> puborbits_y [tcellindex * 256 + tlightindex] = puborbits_y [tcellindex * 256 + tlightindex + 1]; <br/>}< br/> puborbits_x [tcellindex * 256 + publightlength] = puborbits_x [tcellindex * 256 + publightlength] + publimit_x [tcellindex] * pubspeed; <br/> puborbits_y [tcellindex * 256 + publightlength] = puborbits_y [tcellindex * 256 + publightlength] + publimit_y [tcellindex] * pubspeed + pgdown; <br/>}</P> <p> function createlimits () {<br/> publimit_x = new array (pubcelllength ); <br/> publimit_y = new array (pubcelllength); <br/> for (VAR torbitsindex = 0; torbitsindex <= pubcelllength; torbitsindex ++) {<br/> taxis_r = math. floor (math. random () * 90) + 10; <br/> taxis_xy = math. floor (math. random () * 360); <br/> taxis_yz = math. floor (math. random () * 360); <br/> taxis_zx = math. floor (math. random () * 360); <br/> var result = {}; <br/> getorbits (result, taxis_xy, taxis_yz, taxis_zx, taxis_r ); <br/> publimit_x [torbitsindex] = result. torbits_x/100; <br/> publimit_y [torbitsindex] = result. torbits_y/100; <br/>}</P> <p> function getorbits (output, paxis_xy, paxis_yz, paxis_zx, paxis_r) {<br/> output. taxis_xy = radiangetbyangle (paxis_xy); <br/> output. taxis_yz = radiangetbyangle (paxis_yz); <br/> output. taxis_zx = radiangetbyangle (paxis_zx); <br/> output. torbits_x = paxis_r * Math. cos (output. taxis_xy) * Math. cos (output. taxis_zx); <br/> output. torbits_y = paxis_r * Math. sin (output. taxis_xy) * Math. sin (output. taxis_yz); <br/>}</P> <p> function radiangetbyangle (Pangle) {<br/> return Pangle * Math. PI/180; <br/>}< br/> </SCRIPT> <br/> </ptml> <br/>
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.