[Programming Game] presents a gift at the age of a new year. (Ignition of fireworks at wcwtitxu, 2-8 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> ialvin.cn </title> <br/> <style> <br/> body {Background: #000; padding: 0; margin: 0; overflow: hidden ;}< br/>. PTR {width: 2px; Height: 2px; overflow: hidden; position: absolute ;} <br/> </style> <br/> <SCRIPT> <br/>/* var winheight; <br/> function mousex (Event) {event = event | window. event; return (event.clientx((document.doc umentelement. scrollleft | document. body. scrollleft) | event. PAG Ey ;}< br/> function Mousey (event) {event = event | window. event; return (event.clienty((document.doc umentelement. scrolltop | document. body. scrolltop) | event. pagey ;}< br/> function getaskwheight () {return window. innerheight | document. body. clientheight;} <br/> window. onload = function (e) {winheight = getwindowheight () ;}; <br/> */</P> <p> function setcolor (p) {<br/> P. R = parseint (P. r/2); p. G = parsein T (P. g/2); p. B = parseint (P. b/2); <br/> If (P. R = 0 & P. G = 0 & P. B = 0) return document. body. removechild (P. PTR); <br/> P. PTR. style. background = "RGB (" + P. R + "," + P. G + "," + P. B + ")"; <br/> setTimeout (function () {setcolor (p) ;}, 150); <br/>}< br/> Function Point (X, y, R, G, B) {<br/> This. PTR = document. createelement ("Div"); <br/> This. PTR. classname = "PTR"; <br/> document. body. appendchild (this. PTR); <br/> This. PTR. s Tyle. left = x + "PX"; <br/> This. PTR. style. top = Y + "PX"; <br/> This. R = 2 * r; <br/> This. G = 2 * g; <br/> This. B = 2 * B; <br/> var P = This; <br/> setTimeout (function () {setcolor (p)}, math. random () * 200); <br/>}< br/> function fireworks (MX, my) {<br/> This. MX = Mx; <br/> This. my = My; <br/> This. cx = Mx; <br/> // This. cy = winheight; <br/> This. cy = document. body. clientheight | document.doc umentelement. clienthei Ght; <br/>}</P> <p> fireworks. prototype. run = function () {<br/> If (this. cy <= This. my) return this. flash (); <br/> New Point (this. CX, this. cy, 0x40, 0x40, 0x40); <br/> This. cy-= 10; <br/> var self = This; <br/> setTimeout (function () {self. run () ;}, 50); <br/>}; <br/> fireworks. prototype. init = function () {<br/> This. FS = []; <br/> for (VAR I = 0; I <20; I ++) {<br/> // The following three rows are out of the loop, move to the loop <br/> var R1 = 128 + math. RA Ndom () * 128; <br/> var G1 = 128 + math. random () * 128; <br/> var b1 = 128 + math. random () * 128; <br/> var o = {R: r1, G: G1, B: B1}; <br/> var d = math. random () * 2 * Math. pi; <br/> var d1 = math. random (); <br/> O. VX = math. sin (d) * D1 * 8; <br/> O. vy = math. cos (d) * D1 * 8; <br/> O. L = parseint (math. random () * 5) + 5; <br/> This. FS [I] = O; <br/> O. X = This. MX; <br/> O. y = This. my; <br/>}< br/>}; <br/> fireworks. prototype. Flash = function () {<br/> If (! This. FS) This. init (); <br/> for (VAR I = 0; I <20; I ++) {<br/> var o = This. FS [I]; <br/> If (O = NULL) continue; <br/> If (O. L <0) {<br/> This. FS [I] = NULL; <br/> continue; <br/>}< br/> O. vy ++ = 0.02; <br/> O. X + = O. VX; <br/> O. Y + = O. vy; <br/> O. l-= 1; <br/> New Point (O. x, O. y, O. r, O. g, O. b); <br/>}< br/> var me = This; <br/> setTimeout (function () {me. flash () ;}, 100); <br/>}; </P> <p> setinterval (function () {< Br/> If (math. random () <0.3) {<br/> var H = document. body. clientheight | document.doc umentelement. clientheight; <br/> var W = document. body. clientwidth | document.doc umentelement. clientwidth; <br/> New fireworks (w * Math. random (), H/3-H/3 * Math. random ()). run () <br/>}< br/>}, 500); <br/>/* <br/> function mclick (Event) {<br/> New fireworks (mousex (event), Mousey (event )). run (); <br/>}*/<br/> </ SCRIPT> <br/> </pead> <body> </body> <! --- <Body onmouseup = "Return mclick (event);"> <span style = "color: # fff"> click the mouse. Don't be too quick, card </span> </body> --> </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.