捌玖网络工作室's Archiver

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

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

脚本说明: I7c\ n0d-V.D]7_%T

t#P cwRQ["i-oDv 第一步:把如下代码加入<body>区域中
9Jv v9jI] <script language="JavaScript">\dd2~1u6]
_fU2S6yk.~
function nextSize(i,incMethod,textLength)
4n nq9a@ {D)}4dH(en'e0Mt
if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );
s7eD x7SM if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));%K \h u$X|.dG7W^
} BmCS#OrZKr

pxiw@H#v a function sizeCycle(text,method,dis),S!{8{` DR
{
.AAk9?9Zpn         output = "";
T~2Wfe@Z|T4K         for (i = 0; i < text.length; i++)
RC.wP7?         {
SY!sh8U                 size = parseInt(nextSize(i +dis,method,text.length));
TVVY@:y aP6^%Bj                 output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";F Y6|5] agj5L U
        }OUD tJQ}#M@
        theDiv.innerHTML = output;4Bx/R@({3dq-E
}7o3sT-i-E3D
"P.o*@"`A j
function doWave(n) V1s@v |g9U
{   3],h JCr%zq6]5Q'l"U
        theText = "JavaScript";
D(S$]D1l[r {.W         sizeCycle(theText,1,n);
I;c:W+|1JS         if (n > theText.length) {n=0}
RYAjJq M o1?e@;r         setTimeout("doWave(" + (n+1) + ")", 50);
:CO*J$@`#}W |nr }
3U5Gb}#Y </script>|-Op?S.R5@i.w\r
<div ID="theDiv" align="center">
p!Fd.hc!o%a
7[{3V{4K!| </div>
-[hjaB@$\.k +`$c {s7P
4A:f9cc:K;j'x

'rr^~dh
@"b e ^e5l 第二步:把如下代码加入<body>区域中<body onload=doWave(0);>

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


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