[Programming Game] New Year's neon. (The first prize is 10000 available points)
Rating
Visit
[Currently, Firefox is easy to use. other browsers must be copied to the local computer and saved as HTML files.]
<! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en"> <br/> <HTML> <br/> <pead> <br/> <meta HTTP -equiv = "keywords" content = "keyword1, keyword2, keyword3 "> <br/> <meta http-equiv =" Description "content =" this is my page "> <br/> <! -- Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8 "--> <br/> <title> myneon </title> <br/> <! -- <LINK rel = "stylesheet" type = "text/CSS" href = ". /styles.css "> --> <br/> </pead> <br/> <body bgcolor = '#000000'> <br/> <SCRIPT type =" text/JavaScript"> <br/>/** <br/> * neon lights <br/> * @ Param {}< br/> * r disc radius <br/> */<br/> neon = function (r) {<br/> This. R = r; <br/> This. pointtexts = ['○', '● ','★',' ■ ',' ◆ ',' ▲ ']; <Br/> This. colors = ['red', 'Orange ', 'yellow', 'green', 'Blue', 'purple ', 'pink']; <br/> This. pointwidth = 20; <br/> This. pointheight = 20; <br/> This. blanklength = This. r/3; <br/> This. O = [document. body. clientwidth/2, document. body. clientheight/2]; <br/> This. points = []; <br/> This. theta = 2 * Math. asin (this. pointwidth/This. blanklength/2); <br/> This. col = math. floor (this. R-this. blanklength)/This. pointwidth); <br/> This. row = math. floor (2 * Math. PI/This. theta); <br/> This. startangle = 2 * Math. pi; <br/> This. A = This. blanklength/This. startangle; <br/> This. endangle = math. floor (this. r/This. a); <br/> This. flashlen = math. floor (this. endangle-this. startangle)/This. theta); <br/> This. flashpoints = []; <br/> This. init (); <br/>}< br/> neon. prototype = {<br/> init: Function () {<br/> This. Theta = (this. Theta> 0 )? This. theta: math. PI/12; <br/> This. bgtext = This. randomtextandcolor (math. floor (math. random () <br/> * This. colors. length), this. pointtexts [math. floor (math. random () <br/> * This. pointtexts. length)]); <br/> for (VAR I = 0; I <= This. row; I ++) {<br/> var PS = []; <br/> for (VAR J = 0; j <this. col; j ++) {<br/> var P = document. createelement ('div '); <br/> P. style. position = 'absolute '; <br/> P. style. height = This. pointheight + 'px '; <br/> P. style. width = This. pointwidth + 'px '; <br/> P. style. left = math. floor (this. O [0] <br/> + (this. blanklength + J * This. pointwidth) <br/> * Math. cos (I * This. theta)-This. pointwidth/2) <br/> + 'px '; <br/> P. style. top = math. floor (this. O [1] <br/>-(this. blanklength + J * This. pointheight) <br/> * Math. sin (I * This. theta)-This. pointheight/2) <br/> + 'px'; <br/> P. innerhtml = This. bgtext; <br/> document. body. appendchild (p); <br/> PS [J] = P; <br/>}< br/> This. points [I] = Ps; <br/>}< br/> for (VAR J = 0; j <= This. flashlen; j ++) {<br/> var fp = []; <br/> FP [0] = J % (this. row + 1); <br/> var Phi = J * This. theta + this. startangle; <br/> FP [1] = math. floor (this. A * phi-this. blanklength) <br/>/This. pointwidth); <br/> This. points [FP [0] [FP [1]. innerhtml = This. randomtextandcolor (Math <br/>. floor (math. random () * This. colors. length), <br/> This. pointtexts [math. floor (math. random () <br/> * This. pointtexts. length)]); <br/> This. flashpoints [J] = FP; <br/>}< br/>}, <br/> Start: function () {<br/> var self = this; <br/> var newtext = This. randomtextandcolor (math. floor (math. random () <br/> * This. colors. length), this. pointtexts [math. floor (math. random () <br/> * This. pointtexts. length)]); <br/> setinterval (function () {<br/> for (var j = 0; j <= self. flashlen; j ++) {<br/> self. points [self. flashpoints [J] [0] [self. flashpoints [J] [1]. innerhtml = newtext; <br/> self. flashpoints [J] [0] --; <br/> If (self. flashpoints [J] [0] ==- 1) {<br/> self. flashpoints [J] [0] = self. row; <br/>}< br/> If (j = 0 & self. flashpoints [0] [0] = 0) {<br/> newtext = self. randomtextandcolor (math. floor (math. random () <br/> * self. colors. length), self. pointtexts [math <br/>. floor (math. random () * self. pointtexts. length)]); <br/>}< br/> self. points [self. flashpoints [J] [0] [self. flashpoints [J] [1]. innerhtml = self <br/>. randomtextandcolor (math. floor (math. random () <br/> * self. colors. length), self. pointtexts [math <br/>. floor (math. random () * self. pointtexts. length)]); <br/>}< br/>}, 30); <br/>}, <br/> randomtextandcolor: function (CI, text) {<br/> return '<span style = "color:' + this. colors [CI] + '; ">' + TEXT <br/> + '</span>'; <br/>}< br/> window. onload = function () {<br/> var neon = New neon (400); <br/> neon. start (); <br/>}< br/> </SCRIPT> <br/> </body> <br/> </ptml>
Visit
[Currently, Firefox is easy to use. other browsers must be copied to the local computer and saved as HTML files.]