發新話題
打印

[分享] 旋轉文字特效

旋轉文字特效

JavaScrip源代碼語法:(將以下代碼加入HTML的<HEAD></HEAD>之間



<SCRIPT language=javascript>

Phrase="此處加入所需文字"
Balises=""
Taille=80;
Midx=250;
Decal=0.5;
Nb=Phrase.length;
y=-10000;
for (x=0;x<Nb;x++){
  Balises=Balises + '<DIV Id=L' + x + ' STYLE="width:5;font-family: Courier New;font-weight:bold;position:absolute;top:40;left:50;z-index:0">' + Phrase.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<Nb;x++){
                Alpha1=Alpha+Decal*x;
                Cosine=Math.cos(Alpha1);
                Ob=document.all("L"+x);
                Ob.style.posLeft=Midx+170*Math.sin(Alpha1)+50;
                Ob.style.zIndex=20*Cosine;
                Ob.style.fontSize=Taille+25*Cosine;
                Ob.style.color="rgb("+ (127+Cosine*80+50) + ","+ (127+Cosine*80+50) + ",0)";
        }
}

</SCRIPT>

[ 本帖最後由 小依萍 於 2007-8-22 09:33 編輯 ]

TOP

HTML語法



<Html>
<Head>
<title>旋轉文字</title>
</Head>
<Body  bgColor="#FFFFFF">
<!--將以下代碼加入HTML的<Body></Body>之間-->
<SCRIPT language=javascript>

Phrase="此處加入所需文字"
Balises=""
Taille=80;
Midx=250;
Decal=0.5;
Nb=Phrase.length;
y=-10000;
for (x=0;x<Nb;x++){
  Balises=Balises + '<DIV Id=L' + x + ' STYLE="width:5;font-family: Courier New;font-weight:bold;position:absolute;top:40;left:50;z-index:0">' + Phrase.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<Nb;x++){
                Alpha1=Alpha+Decal*x;
                Cosine=Math.cos(Alpha1);
                Ob=document.all("L"+x);
                Ob.style.posLeft=Midx+170*Math.sin(Alpha1)+50;
                Ob.style.zIndex=20*Cosine;
                Ob.style.fontSize=Taille+25*Cosine;
                Ob.style.color="rgb("+ (127+Cosine*80+50) + ","+ (127+Cosine*80+50) + ",0)";
        }
}

</SCRIPT>
</Body>
</Html>


[ 本帖最後由 小依萍 於 2007-8-22 09:36 編輯 ]

TOP

發新話題