|
5 | 5 | <title></title>
|
6 | 6 | <link rel="stylesheet" type="text/css" href="style.css">
|
7 | 7 | <meta name="viewport" content="width=device-width, initial-scale=0.1">
|
| 8 | + <script type="text/javascript"> |
| 9 | + // <![CDATA[ |
| 10 | + var colour="random"; // in addition to "random" can be set to any valid colour eg "#f0f" or "red" |
| 11 | + var sparkles=50; |
| 12 | + |
| 13 | + /**************************** |
| 14 | + * Tinkerbell Magic Sparkle * |
| 15 | + *(c)2005-13 mf2fm web-design* |
| 16 | + * http://www.mf2fm.com/rv * |
| 17 | + * DON'T EDIT BELOW THIS BOX * |
| 18 | + ****************************/ |
| 19 | + var x=ox=400; |
| 20 | + var y=oy=300; |
| 21 | + var swide=800; |
| 22 | + var shigh=600; |
| 23 | + var sleft=sdown=0; |
| 24 | + var tiny=new Array(); |
| 25 | + var star=new Array(); |
| 26 | + var starv=new Array(); |
| 27 | + var starx=new Array(); |
| 28 | + var stary=new Array(); |
| 29 | + var tinyx=new Array(); |
| 30 | + var tinyy=new Array(); |
| 31 | + var tinyv=new Array(); |
| 32 | + |
| 33 | + window.onload=function() { if (document.getElementById) { |
| 34 | + var i, rats, rlef, rdow; |
| 35 | + for (var i=0; i<sparkles; i++) { |
| 36 | + var rats=createDiv(3, 3); |
| 37 | + rats.style.visibility="hidden"; |
| 38 | + rats.style.zIndex="999"; |
| 39 | + document.body.appendChild(tiny[i]=rats); |
| 40 | + starv[i]=0; |
| 41 | + tinyv[i]=0; |
| 42 | + var rats=createDiv(5, 5); |
| 43 | + rats.style.backgroundColor="transparent"; |
| 44 | + rats.style.visibility="hidden"; |
| 45 | + rats.style.zIndex="999"; |
| 46 | + var rlef=createDiv(1, 5); |
| 47 | + var rdow=createDiv(5, 1); |
| 48 | + rats.appendChild(rlef); |
| 49 | + rats.appendChild(rdow); |
| 50 | + rlef.style.top="2px"; |
| 51 | + rlef.style.left="0px"; |
| 52 | + rdow.style.top="0px"; |
| 53 | + rdow.style.left="2px"; |
| 54 | + document.body.appendChild(star[i]=rats); |
| 55 | + } |
| 56 | + set_width(); |
| 57 | + sparkle(); |
| 58 | + }} |
| 59 | + |
| 60 | + function sparkle() { |
| 61 | + var c; |
| 62 | + if (Math.abs(x-ox)>1 || Math.abs(y-oy)>1) { |
| 63 | + ox=x; |
| 64 | + oy=y; |
| 65 | + for (c=0; c<sparkles; c++) if (!starv[c]) { |
| 66 | + star[c].style.left=(starx[c]=x)+"px"; |
| 67 | + star[c].style.top=(stary[c]=y+1)+"px"; |
| 68 | + star[c].style.clip="rect(0px, 5px, 5px, 0px)"; |
| 69 | + star[c].childNodes[0].style.backgroundColor=star[c].childNodes[1].style.backgroundColor=(colour=="random")?newColour():colour; |
| 70 | + star[c].style.visibility="visible"; |
| 71 | + starv[c]=50; |
| 72 | + break; |
| 73 | + } |
| 74 | + } |
| 75 | + for (c=0; c<sparkles; c++) { |
| 76 | + if (starv[c]) update_star(c); |
| 77 | + if (tinyv[c]) update_tiny(c); |
| 78 | + } |
| 79 | + setTimeout("sparkle()", 40); |
| 80 | + } |
| 81 | + |
| 82 | + function update_star(i) { |
| 83 | + if (--starv[i]==25) star[i].style.clip="rect(1px, 4px, 4px, 1px)"; |
| 84 | + if (starv[i]) { |
| 85 | + stary[i]+=1+Math.random()*3; |
| 86 | + starx[i]+=(i%5-2)/5; |
| 87 | + if (stary[i]<shigh+sdown) { |
| 88 | + star[i].style.top=stary[i]+"px"; |
| 89 | + star[i].style.left=starx[i]+"px"; |
| 90 | + } |
| 91 | + else { |
| 92 | + star[i].style.visibility="hidden"; |
| 93 | + starv[i]=0; |
| 94 | + return; |
| 95 | + } |
| 96 | + } |
| 97 | + else { |
| 98 | + tinyv[i]=50; |
| 99 | + tiny[i].style.top=(tinyy[i]=stary[i])+"px"; |
| 100 | + tiny[i].style.left=(tinyx[i]=starx[i])+"px"; |
| 101 | + tiny[i].style.width="2px"; |
| 102 | + tiny[i].style.height="2px"; |
| 103 | + tiny[i].style.backgroundColor=star[i].childNodes[0].style.backgroundColor; |
| 104 | + star[i].style.visibility="hidden"; |
| 105 | + tiny[i].style.visibility="visible" |
| 106 | + } |
| 107 | + } |
| 108 | + |
| 109 | + function update_tiny(i) { |
| 110 | + if (--tinyv[i]==25) { |
| 111 | + tiny[i].style.width="1px"; |
| 112 | + tiny[i].style.height="1px"; |
| 113 | + } |
| 114 | + if (tinyv[i]) { |
| 115 | + tinyy[i]+=1+Math.random()*3; |
| 116 | + tinyx[i]+=(i%5-2)/5; |
| 117 | + if (tinyy[i]<shigh+sdown) { |
| 118 | + tiny[i].style.top=tinyy[i]+"px"; |
| 119 | + tiny[i].style.left=tinyx[i]+"px"; |
| 120 | + } |
| 121 | + else { |
| 122 | + tiny[i].style.visibility="hidden"; |
| 123 | + tinyv[i]=0; |
| 124 | + return; |
| 125 | + } |
| 126 | + } |
| 127 | + else tiny[i].style.visibility="hidden"; |
| 128 | + } |
| 129 | + |
| 130 | + document.onmousemove=mouse; |
| 131 | + function mouse(e) { |
| 132 | + if (e) { |
| 133 | + y=e.pageY; |
| 134 | + x=e.pageX; |
| 135 | + } |
| 136 | + else { |
| 137 | + set_scroll(); |
| 138 | + y=event.y+sdown; |
| 139 | + x=event.x+sleft; |
| 140 | + } |
| 141 | + } |
| 142 | + |
| 143 | + window.onscroll=set_scroll; |
| 144 | + function set_scroll() { |
| 145 | + if (typeof(self.pageYOffset)=='number') { |
| 146 | + sdown=self.pageYOffset; |
| 147 | + sleft=self.pageXOffset; |
| 148 | + } |
| 149 | + else if (document.body && (document.body.scrollTop || document.body.scrollLeft)) { |
| 150 | + sdown=document.body.scrollTop; |
| 151 | + sleft=document.body.scrollLeft; |
| 152 | + } |
| 153 | + else if (document.documentElement && (document.documentElement.scrollTop || document.documentElement.scrollLeft)) { |
| 154 | + sleft=document.documentElement.scrollLeft; |
| 155 | + sdown=document.documentElement.scrollTop; |
| 156 | + } |
| 157 | + else { |
| 158 | + sdown=0; |
| 159 | + sleft=0; |
| 160 | + } |
| 161 | + } |
| 162 | + |
| 163 | + window.onresize=set_width; |
| 164 | + function set_width() { |
| 165 | + var sw_min=999999; |
| 166 | + var sh_min=999999; |
| 167 | + if (document.documentElement && document.documentElement.clientWidth) { |
| 168 | + if (document.documentElement.clientWidth>0) sw_min=document.documentElement.clientWidth; |
| 169 | + if (document.documentElement.clientHeight>0) sh_min=document.documentElement.clientHeight; |
| 170 | + } |
| 171 | + if (typeof(self.innerWidth)=='number' && self.innerWidth) { |
| 172 | + if (self.innerWidth>0 && self.innerWidth<sw_min) sw_min=self.innerWidth; |
| 173 | + if (self.innerHeight>0 && self.innerHeight<sh_min) sh_min=self.innerHeight; |
| 174 | + } |
| 175 | + if (document.body.clientWidth) { |
| 176 | + if (document.body.clientWidth>0 && document.body.clientWidth<sw_min) sw_min=document.body.clientWidth; |
| 177 | + if (document.body.clientHeight>0 && document.body.clientHeight<sh_min) sh_min=document.body.clientHeight; |
| 178 | + } |
| 179 | + if (sw_min==999999 || sh_min==999999) { |
| 180 | + sw_min=800; |
| 181 | + sh_min=600; |
| 182 | + } |
| 183 | + swide=sw_min; |
| 184 | + shigh=sh_min; |
| 185 | + } |
| 186 | + |
| 187 | + function createDiv(height, width) { |
| 188 | + var div=document.createElement("div"); |
| 189 | + div.style.position="absolute"; |
| 190 | + div.style.height=height+"px"; |
| 191 | + div.style.width=width+"px"; |
| 192 | + div.style.overflow="hidden"; |
| 193 | + return (div); |
| 194 | + } |
| 195 | + |
| 196 | + function newColour() { |
| 197 | + var c=new Array(); |
| 198 | + c[0]=255; |
| 199 | + c[1]=Math.floor(Math.random()*256); |
| 200 | + c[2]=Math.floor(Math.random()*(256-c[1]/2)); |
| 201 | + c.sort(function(){return (0.5 - Math.random());}); |
| 202 | + return ("rgb("+c[0]+", "+c[1]+", "+c[2]+")"); |
| 203 | + } |
| 204 | + // ]]> |
| 205 | + </script> |
8 | 206 | </head>
|
9 | 207 | <body class="page">
|
10 | 208 | <h1>Hi, I am Squircle, and welcome inside my computer.</h1>
|
|
0 commit comments