Code
<html>
<head>
<title>Изменение словами местоположения и цвета</title>
<style type="text/css">
.rotateOBJ { POSITION: relative }
</style>
<SCRIPT language=JavaScript>
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 */
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 = "#009900";
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 = "#006600";
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 phase in turn */
highlight(1,0);
}
</SCRIPT>
</head>
<body bgcolor="000000" text="#00ff99" link="#00ff00" alink="#99ff00" vlink="#00cc00" onload="doit()">
<iframe src="../menu.htm" align="left" width="140" height="560" scrolling="no" frameborder="0"></iframe>
<p>
<CENTER><FONT color="#006600">
<strong><em><FONT face="" size="5"><SPAN class="rotateOBJ" id="obj1">"Жизнь</SPAN></FONT>
<BR><FONT face="" size="5"><SPAN class="rotateOBJ" id="obj2">течет</SPAN></FONT>
<BR><FONT face="" size="5"><SPAN class="rotateOBJ" id="obj3">все "</SPAN></FONT>
<BR></em><FONT face="" size="3"><SPAN class="rotateOBJ" id="obj4">меняется</SPAN></FONT> </strong>
</CENTER>
</FONT>
</body>
</html>