Js implements flying star special effect code, js implements star special effect code

Source: Internet
Author: User

Js implements flying star special effect code, js implements star special effect code

The example in this article describes the code for js to implement the special effects of flying stars, which will be shared with you for your reference.

The specific implementation code is as follows:

Copy codeThe Code is as follows: <Head>
<Title> Effect of Flying Stars quickly </title>
<Style type = "text/css">
<! --
Body {
Background-color: #000066;
}
-->
</Style>
</Head>
<Body>
<Script language = "JavaScript">
XL = 8;
XH = xW = xR = xE = xMY = xMX = xWd = xHd = 0;
XF = new Array ();
XY = new Array ();
XX = new Array ();
XS = new Array ();
XA = new Array ();
XB = new Array ();
Ini = new Array ();
Document. write ('<div id = "sdiv" style = "position: absolute; top: 0px; left: 0px"> <div style = "position: relative"> ');
For (I = 0; I <xL; I ++ ){
Document. write ('<div id = "div" style = "position: absolute; top: 0; left: 0; width: 5px; height: 5px;' + 'font-size: 10px; color: # ffffff ">. </div> ');
}
Document. write ('</div> ');
Function Set (){
For (I = 0; I <xL; I ++ ){
Transfer (I)
XF [I] = xW/14;
}
}
Function Assign (){
Sdiv. style. top = document. body. scrollTop;
For (I = 0; I <xL; I ++ ){
XF [I]-= xS [I] * 25;
If (xF [I] <4) xF [I] = 3;
Div [I]. style. top = xY [I];
Div [I]. style. left = xX [I];
Div [I]. style. fontSize = xF [I];
}
}
Function fly (){
Xmydomainclientdoc ument. body. clientHeight/2;
Xmxdeskdomaindomaindoc ument. body. clientWidth/2;
XWd = Math. round (Math. random () * 40 + 5 );
XHd = Math. round (Math. random () * 30 + 5 );
For (I = 0; I <xL; I ++ ){
XY [I] = xA [I] + = (xMY-xA [I]) * (xS [I]);
XX [I] = xB [I] + = (xMX-xB [I]) * (xS [I]);
If (xX [I]> xMX-xWd) & (xX [I] <xMX + xWd) & (xY [I]> xMY-xHd) & (xY [I] <xMY + xHd )){
Transfer (I)
}
If (xX [I] <0) | (xX [I]> xW) | (xY [I] <0) | (xY [I]> xH )){
XF [I] = xW/14;
}
}
Assign ();
SetTimeout ('fly () ', 1 );
}
Function transfer (I ){
Xhsf-domaindoc ument. body. offsetHeight;
Xw=windodoc ument. body. offsetWidth;
XA [I] = Math. round (Math. random () * xH );
XB [I] = Math. round (Math. random () * xW );
XS [I] = Math. random () × 0.05 + 0.05;
XR = Math. round (Math. random () * 3 );
XE = Math. round (Math. random () * 50 + 50 );
If (xR = 3) xB [I] =-xE;
If (xR = 2) xB [I] = xW + xE;
If (xR = 1) xA [I] =-xE;
If (xR = 0) xA [I] = xH;
}
Set ();
Fly ();
</Script>
</Body>
</Html> </td>
</Tr>
</Table>

I hope this article will help you design javascript programs.


How can I change the image of this js special effect code ??

Var sohuFlash2 = new sohuFlash ("../images/flaplus01.swf", "27", 520,205, "7 ");
Let's see this sentence. The effect is that the addresses of the images are uploaded to the flash as parameters. Therefore, the reusability of this special effect is very poor. You can't use it. Find another one.

A js image special effect code with high scores

Brother, you are too lazy to go to my website. There are too many similar code.
You can change the CSS slightly. Go to Baidu to search for the JS special effects school or go to the following URL
There is a lot of code you need. I cannot ask for help.
Reference: www.jsweb8.cn

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.