<html>
<title>实例13</title>
<body>
<script language=javascript>
message="旋转的文字"
Balises=""
Taille=40;
Midx=40;
Decal=0.5;
num=message.length;
y=-1000;
for (x=0;x<num;x++)
{Balises=Balises + '<DIV Id=L' + x + ' STYLE="width:4;font-family: 宋体; font-weight:bold;position:absolute;top:100;left:100">' + message.charAt(x) + '</DIV>'
}
document.write (Balises);
Time=window.setInterval("Alors()",10);
Alpha=5;
I_Alpha=0.05;
function Alors()
{Alpha=Alpha-I_Alpha;
 for(x=0;x<num;x++)
 {Alpha1=Alpha+Decal*x;
  Cosine=Math.cos(Alpha1);
  Ob=document.all("L"+x);
  Ob.style.posLeft=Midx+100*Math.sin(Alpha1)+260;
  Ob.style.zIndex=10*Cosine;
  Ob.style.fontSize=Taille+25*Cosine;
  Ob.style.color="rgb("+ (20+Cosine*80+150) + ","+ (227+Cosine*80+250) + ",0)";
 }
}
</script>
</body>
</html>

解决方案 »

  1.   

    只能使用canvas,不过FF中canvas对文本支持不太好,需要fix,搜索一下吧。
      

  2.   


    message = "旋转的文字"
    Balises = ""
    Taille = 40;
    Midx = 40;
    Decal = 0.5;
    num = message.length;
    y = -1000;
    for (x = 0; x < num; x++) {
    Balises = Balises
    + ' <DIV Id=L'
    + x
    + ' STYLE="width:4;font-family: 宋体; font-weight:bold;position:absolute;top:100;left:100">'
    + message.charAt(x) + ' </DIV>'
    }
    document.write(Balises);
    Time = window.setInterval("Alors()", 10);
    Alpha = 5;
    I_Alpha = 0.05;
    function Alors() {
    Alpha = Alpha - I_Alpha;
    for (x = 0; x < num; x++) {
    Alpha1 = Alpha + Decal * x;
    Cosine = Math.cos(Alpha1);
    Ob = document.getElementById("L" + x);
    Ob.style.left = (Midx + 100 * Math.sin(Alpha1) + 260)+'px';
    Ob.style.zIndex = 10 * Cosine;
    Ob.style.fontSize = Taille + 25 * Cosine;
    Ob.style.color = "rgb(" + (20 + Cosine * 80 + 150) + ","
    + (227 + Cosine * 80 + 250) + ",0)";
    }
    }
      

  3.   

    字体大小message = "旋转的文字"
    Balises = ""
    Taille = 40;
    Midx = 40;
    Decal = 0.5;
    num = message.length;
    y = -1000;
    for (x = 0; x < num; x++) {
    Balises = Balises
    + ' <DIV Id=L'
    + x
    + ' STYLE="width:4;font-family: 宋体; font-weight:bold;position:absolute;top:100;left:100">'
    + message.charAt(x) + ' </DIV>'
    }
    document.write(Balises);
    Time = window.setInterval("Alors()", 10);
    Alpha = 5;
    I_Alpha = 0.05;
    function Alors() {
    Alpha = Alpha - I_Alpha;
    for (x = 0; x < num; x++) {
    Alpha1 = Alpha + Decal * x;
    Cosine = Math.cos(Alpha1);
    Ob = document.getElementById("L" + x);
    Ob.style.left = (Midx + 100 * Math.sin(Alpha1) + 260)+'px';
    Ob.style.zIndex = 10 * Cosine;
    Ob.style.fontSize = (Taille + 25 * Cosine)+'px';
    Ob.style.color = "rgb(" + (20 + Cosine * 80 + 150) + ","
    + (227 + Cosine * 80 + 250) + ",0)";
    }
    }