Estrelinhas caindo do cursor *
Autor: Heloisa Sousa | Publicado: 2012-05-06T19:36:00-03:00

Estrelinhas Caindo do Cursor Do Mouse&nbsp;
Oii gente ! Hoje ensinarei como colocar estrelinhas caindo do cursor do mouse para o blog, Espero que gostem da explicação ;D&nbsp;

&nbsp;1° Passo copie este código enorme :

&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 , Vá em Design -&gt; Adicionar Gadget &nbsp;:



&nbsp;



&nbsp;3° Passo , Clique em &nbsp;HTML/JavaScript :








4° Passo, Cole o código enorme, (mais não coloque título) :



&nbsp;




5º Passo- &nbsp;Vá nesse site &nbsp; &nbsp;http://www.mxstudio.com.br/Conteudos/Dreamweaver/Cores.htm&nbsp; &nbsp; &nbsp; &nbsp;e escolha a cor da sua estrelinha e copie o código HTML dela. &nbsp;


6º Passo- Vá para o&nbsp;&nbsp;HTML/JavaScript&nbsp;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). Depois é só salvar e pronto!






Se Não conseguiu , comente ai o seu problema que eu&nbsp;

te ajudarei !!

&nbsp; ;D