Estrelinhas caindo do mouse no seu blog!
Autor: Thais | Publicado: 2011-06-11T07:07:00-07:00

Olá!!!Vou ensinar hoje como fazer cair estrelinhas no mouse do seu blog ou site!

1º Passo- Copie(CTRL+C) esse código GRANDE!!:



&lt;script type='text/javascript'&gt;
// &lt;![CDATA[
var colour="#FFD700";
var sparkles=50;
var x=ox=400;
var y=oy=300;
var swide=800;
var shigh=600;
var sleft=sdown=0;
var tiny=new Array();
var star=new Array();
var starv=new Array();
var starx=new Array();
var stary=new Array();
var tinyx=new Array();
var tinyy=new Array();
var tinyv=new Array();
window.onload=function() { if (document.getElementById) {
&nbsp;&nbsp;var i, rats, rlef, rdow;
&nbsp;&nbsp;for (var i=0; i&lt;sparkles; i++) {
&nbsp;&nbsp; &nbsp;var rats=createDiv(3, 3);
&nbsp;&nbsp; &nbsp;rats.style.visibility="hidden";
&nbsp;&nbsp; &nbsp;document.body.appendChild(tiny[i]=rats);
&nbsp;&nbsp; &nbsp;starv[i]=0;
&nbsp;&nbsp; &nbsp;tinyv[i]=0;
&nbsp;&nbsp; &nbsp;var rats=createDiv(5, 5);
&nbsp;&nbsp; &nbsp;rats.style.backgroundColor="transparent";
&nbsp;&nbsp; &nbsp;rats.style.visibility="hidden";
&nbsp;&nbsp; &nbsp;var rlef=createDiv(1, 5);
&nbsp;&nbsp; &nbsp;var rdow=createDiv(5, 1);
&nbsp;&nbsp; &nbsp;rats.appendChild(rlef);
&nbsp;&nbsp; &nbsp;rats.appendChild(rdow);
&nbsp;&nbsp; &nbsp;rlef.style.top="2px";
&nbsp;&nbsp; &nbsp;rlef.style.left="0px";
&nbsp;&nbsp; &nbsp;rdow.style.top="0px";
&nbsp;&nbsp; &nbsp;rdow.style.left="2px";
&nbsp;&nbsp; &nbsp;document.body.appendChild(star[i]=rats);
&nbsp;&nbsp;}
&nbsp;&nbsp;set_width();
&nbsp;&nbsp;sparkle();
}}
function sparkle() {
&nbsp;&nbsp;var c;
&nbsp;&nbsp;if (x!=ox || y!=oy) {
&nbsp;&nbsp; &nbsp;ox=x;
&nbsp;&nbsp; &nbsp;oy=y;
&nbsp;&nbsp; &nbsp;for (c=0; c&lt;sparkles; c++) if (!starv[c]) {
&nbsp;&nbsp; &nbsp; &nbsp;star[c].style.left=(starx[c]=x)+"px";
&nbsp;&nbsp; &nbsp; &nbsp;star[c].style.top=(stary[c]=y)+"px";
&nbsp;&nbsp; &nbsp; &nbsp;star[c].style.clip="rect(0px, 5px, 5px, 0px)";
&nbsp;&nbsp; &nbsp; &nbsp;star[c].style.visibility="visible";
&nbsp;&nbsp; &nbsp; &nbsp;starv[c]=50;
&nbsp;&nbsp; &nbsp; &nbsp;break;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;for (c=0; c&lt;sparkles; c++) {
&nbsp;&nbsp; &nbsp;if (starv[c]) update_star(c);
&nbsp;&nbsp; &nbsp;if (tinyv[c]) update_tiny(c);
&nbsp;&nbsp;}
&nbsp;&nbsp;setTimeout("sparkle()", 40);
}
function update_star(i) {
&nbsp;&nbsp;if (--starv[i]==25) star[i].style.clip="rect(1px, 4px, 4px, 1px)";
&nbsp;&nbsp;if (starv[i]) {
&nbsp;&nbsp; &nbsp;stary[i]+=1+Math.random()*3;
&nbsp;&nbsp; &nbsp;if (stary[i]&lt;shigh+sdown) {
&nbsp;&nbsp; &nbsp; &nbsp;star[i].style.top=stary[i]+"px";
&nbsp;&nbsp; &nbsp; &nbsp;starx[i]+=(i%5-2)/5;
&nbsp;&nbsp; &nbsp; &nbsp;star[i].style.left=starx[i]+"px";
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;else {
&nbsp;&nbsp; &nbsp; &nbsp;star[i].style.visibility="hidden";
&nbsp;&nbsp; &nbsp; &nbsp;starv[i]=0;
&nbsp;&nbsp; &nbsp; &nbsp;return;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;else {
&nbsp;&nbsp; &nbsp;tinyv[i]=50;
&nbsp;&nbsp; &nbsp;tiny[i].style.top=(tinyy[i]=stary[i])+"px";
&nbsp;&nbsp; &nbsp;tiny[i].style.left=(tinyx[i]=starx[i])+"px";
&nbsp;&nbsp; &nbsp;tiny[i].style.width="2px";
&nbsp;&nbsp; &nbsp;tiny[i].style.height="2px";
&nbsp;&nbsp; &nbsp;star[i].style.visibility="hidden";
&nbsp;&nbsp; &nbsp;tiny[i].style.visibility="visible"
&nbsp;&nbsp;}
}
function update_tiny(i) {
&nbsp;&nbsp;if (--tinyv[i]==25) {
&nbsp;&nbsp; &nbsp;tiny[i].style.width="1px";
&nbsp;&nbsp; &nbsp;tiny[i].style.height="1px";
&nbsp;&nbsp;}
&nbsp;&nbsp;if (tinyv[i]) {
&nbsp;&nbsp; &nbsp;tinyy[i]+=1+Math.random()*3;
&nbsp;&nbsp; &nbsp;if (tinyy[i]&lt;shigh+sdown) {
&nbsp;&nbsp; &nbsp; &nbsp;tiny[i].style.top=tinyy[i]+"px";
&nbsp;&nbsp; &nbsp; &nbsp;tinyx[i]+=(i%5-2)/5;
&nbsp;&nbsp; &nbsp; &nbsp;tiny[i].style.left=tinyx[i]+"px";
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;else {
&nbsp;&nbsp; &nbsp; &nbsp;tiny[i].style.visibility="hidden";
&nbsp;&nbsp; &nbsp; &nbsp;tinyv[i]=0;
&nbsp;&nbsp; &nbsp; &nbsp;return;
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;else tiny[i].style.visibility="hidden";
}
document.onmousemove=mouse;
function mouse(e) {
&nbsp;&nbsp;set_scroll();
&nbsp;&nbsp;y=(e)?e.pageY:event.y+sdown;
&nbsp;&nbsp;x=(e)?e.pageX:event.x+sleft;
}
function set_scroll() {
&nbsp;&nbsp;if (typeof(self.pageYOffset)=="number") {
&nbsp;&nbsp; &nbsp;sdown=self.pageYOffset;
&nbsp;&nbsp; &nbsp;sleft=self.pageXOffset;
&nbsp;&nbsp;}
&nbsp;&nbsp;else if (document.body.scrollTop || document.body.scrollLeft) {
&nbsp;&nbsp; &nbsp;sdown=document.body.scrollTop;
&nbsp;&nbsp; &nbsp;sleft=document.body.scrollLeft;
&nbsp;&nbsp;}
&nbsp;&nbsp;else if (document.documentElement &amp;&amp; (document.documentElement.scrollTop || document.documentElement.scrollLeft)) {
&nbsp;&nbsp; &nbsp;sleft=document.documentElement.scrollLeft;
&nbsp;&nbsp; &nbsp;sdown=document.documentElement.scrollTop;
&nbsp;&nbsp;}
&nbsp;&nbsp;else {
&nbsp;&nbsp; &nbsp;sdown=0;
&nbsp;&nbsp; &nbsp;sleft=0;
&nbsp;&nbsp;}
}
window.onresize=set_width;
function set_width() {
&nbsp;&nbsp;if (typeof(self.innerWidth)=="number") {
&nbsp;&nbsp; &nbsp;swide=self.innerWidth;
&nbsp;&nbsp; &nbsp;shigh=self.innerHeight;
&nbsp;&nbsp;}
&nbsp;&nbsp;else if (document.documentElement &amp;&amp; document.documentElement.clientWidth) {
&nbsp;&nbsp; &nbsp;swide=document.documentElement.clientWidth;
&nbsp;&nbsp; &nbsp;shigh=document.documentElement.clientHeight;
&nbsp;&nbsp;}
&nbsp;&nbsp;else if (document.body.clientWidth) {
&nbsp;&nbsp; &nbsp;swide=document.body.clientWidth;
&nbsp;&nbsp; &nbsp;shigh=document.body.clientHeight;
&nbsp;&nbsp;}
}
function createDiv(height, width) {
&nbsp;&nbsp;var div=document.createElement("div");
&nbsp;&nbsp;div.style.position="absolute";
&nbsp;&nbsp;div.style.height=height+"px";
&nbsp;&nbsp;div.style.width=width+"px";
&nbsp;&nbsp;div.style.overflow="hidden";
&nbsp;&nbsp;div.style.backgroundColor=colour;
&nbsp;&nbsp;return (div);
}
// ]]&gt;
&lt;/script&gt;

2º Passo- Cole(CTRL+V) o código,No bloco de notas,ou no Microsoft Office.Em qualquer lugar,mais nao perca.

3ºPasso- Entre nesse Site:&gt;&nbsp;&nbsp;http://www.mxstudio.com.br/Conteudos/Dreamweaver/Cores.htm&nbsp;. 
E escolha a Cor de estrelinha que voce quer.Imagem para voces verem(mais voces que escolhem a cor):

4ºPasso-Vá para o bloco de notas e edite a terceira linha do código, no lugar de&nbsp;#FFD700 você vai colocar o código da cor que você escolheu. ( Verifique se o seu código está entre aspas&nbsp;"#FFD700", se não tiver coloque)5ºPasso-Vá no Desing no Blogger ou no Bloggerpot,e entre.Entrou?Entao clik em Adicionar GadGet,e Add o HTML/JavaScript.

6ºFinal-Cole o código!

Até,Anninha♥