인터넷정보

텍스트 랜덤으로 이동시키기

알 수 없는 사용자 2007. 10. 18. 14:07
<html>
<head>

<SCRIPT LANGUAGE="JavaScript">

/* DHTML Scriptlets by TheShadow (theshadow@icon.co.za)
* Script #1 - "Hovering Text"
* 1 September 1998
* You may use and modify this code but you may not charge for it or works
* derived from it. Due credit is appreciated.
* Other scriptlets can be found at: http://www.icon.co.za/~andrewk
*/

arrCos = new Array(360);    /* Hold the COS lookup table for 0 to 359 deg */
arrSin = new Array(360);    /* Hold the SIN lookup table for 0 to 359 deg */

/* Generate the SIN and COS lookup tables. In reality SIN and COS are usually FAR
* slower than the functions that manipulate co-ordinates and plot graphics on the
* screen. But when it comes to doing things with DHTML, the reality is that the
* speed of SIN and COS don't really matter. But in the name of good programming
* technique, I'm using lookup tables - sue me :)
* Basically the way they work, for those who don't know, is that we compute all
* the possible values that we might need from SIN and COS and put them into an array.
* From then on we just look them up in the array instead of computing them each time.
*/

for (i=0;i<360;i++) {
    arrSin[i] = Math.sin(i * Math.PI / 180);
    arrCos[i] = Math.cos(i * Math.PI / 180);
}

function rotate(objID, x, y, r, deg, rinc) {
    /* objID    - the ID of the object we're gonna manipulate
     * x        - current object x-axis
     * y        - current object y-axis
     * r        - current object radius
     * deg      - current rotation around axis in degrees
     * rinc     - by how much we'll increment the radius this time
     */

    y = r * arrSin[deg];
    x = r * arrCos[deg];

    document.all[objID].style.pixelLeft = x;
    document.all[objID].style.pixelTop = y+r+10;

    if (deg % 60 == 0) r += rinc;

    /* Has the radius reached it's maximum/minumum? If so, change the sign of the rinc
     * so that instead of incrementing we decrement - and visa versa
     */
    if (r > 60 || r < 10) {
        rinc *= -1;
        r += rinc;
    }

    deg += 5;
    if (deg >= 360) deg = 0;

    setTimeout("rotate('" + objID + "'," + x + "," + y + "," + r + "," + deg + "," + rinc + ")", 10);
}

function highlight(objNum, lastNum) {
    /* objNum   -   which object to highlight
     * lastNum  -   which object is currently highlighted
     */

    document.all["obj" + objNum].style.color = "#FFCE5E";
    document.all["obj" + objNum].style.fontStyle = "italic";

    if (lastNum != 0) document.all["obj" + lastNum].style.color = "";
    if (lastNum != 0) document.all["obj" + lastNum].style.fontStyle = "";

    lastNum = objNum;
    if (++objNum > 3) objNum = 1;   /* Have we reached the last object? */

    document.all["obj" + objNum].style.color = "#FF7700";

    setTimeout("highlight(" + objNum+ "," + lastNum + ")", 2000);
}

function doit() {
    x=0;            /* initial x-axis position  */
    y=0;            /* initial y-axis position  */
    r=10;           /* initial radius           */
    deg=0;          /* initial rotation around axis (in degrees) */
    rinc = 1;       /* radius increment         */

    /* Begin rotating each phrase with possible offsets to the initial values */
    rotate("obj1", x, y, r+10, deg, rinc);
    rotate("obj2", x, y, r, deg+45, rinc);
    rotate("obj3", x, y, r+20, deg+90, rinc);
    rotate("obj4", x, y, r, deg+270, rinc);

    /* Begin highlighting each phrase in turn */
    highlight(1,0);
}

</SCRIPT>

<STYLE>
.rotateOBJ {position:relative}
</STYLE>

</head>
<body ONLOAD="doit();" style="font-family:Verdana; font-size:15pt;">

<table width=300>
<tr><td>

<FONT COLOR="#336600"><B><I><FONT style=font-size:9pt><SPAN CLASS=rotateOBJ ID=obj1>태그피아에 오신걸 환영합니다</SPAN></FONT>

</font><FONT COLOR="#FFCE5E"><FONT style=font-size:9pt><SPAN CLASS=rotateOBJ ID=obj2>카멜롯™</SPAN></FONT>

<FONT COLOR="teal"><FONT style=font-size:9pt<SPAN CLASS=rotateOBJ ID=obj3>http://oxtag.com</SPAN></FONT>

<FONT COLOR="#99CC00" style=font-size:9pt><SPAN CLASS=rotateOBJ ID=obj4>태그피아</SPAN></font>

</td>
</tr>
</table>

</body>
</html>
반응형