捌玖网络工作室's Archiver

zw2004 发表于 2008-1-21 20:50

网页之奇特的文字变化特效

脚本说明: Hg(~B'Yh2^ nPG

:X!]+_p#njM 第一步:把如下代码加入<body>区域中rF5r'k1o
<script language="JavaScript">
xD@ VLGv;U/@4u *SJqf0f)z c#W
function nextSize(i,incMethod,textLength)
6` ~ h4],Px(zLV {
^%r9{ c.d%U'N8U'T if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );
9W P$p}?9A6id~ if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14)))); L3P/g&a9[n
}
4a4K X'^$K FO;N|
A|qQS-zek function sizeCycle(text,method,dis)-kG'Z8Ym1`2o
{
C5z3r4cW*MX X         output = "";"A,T5d;[ H3S#UNJ
        for (i = 0; i < text.length; i++)
|Ge#St:?vU-h|         {
H]X/vN                 size = parseInt(nextSize(i +dis,method,text.length));
{w7P"t%hp\                 output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
]6{+VC6BT*~N.U[#O-h*@         }
)PN2?c\$]1gs         theDiv.innerHTML = output;
!tL7t;c,LK\ } B kuvYz#kD
^)pI{ e3KuS\[
function doWave(n)
t%Cc4St S)O+?)Uv {   
#B/E0\#m {v         theText = "JavaScript";X nV3Cs2N
        sizeCycle(theText,1,n);HD H b,n
        if (n > theText.length) {n=0}7h9z#qs!Fg$\l
        setTimeout("doWave(" + (n+1) + ")", 50);H%Z bcG |k h$J
}&HO4sjhj q!F
</script>N!F-MYp6K
<div ID="theDiv" align="center">
b"Q3n+T9Qu[ tS-]%bK
</div>
LA+^6I;CL Z
zf{_6o9U T2UD
cY7QUbr+Q&f'a1t#D (Y^t9_UUq
2MDf%W m)APISnt3k-z
第二步:把如下代码加入<body>区域中<body onload=doWave(0);>

页: [1]
【捌玖网络】已经运行:


Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.