捌玖网络工作室's Archiver

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

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

脚本说明:
+r.Kl"Z%_fN V4uHK;d*b2J*rw
第一步:把如下代码加入<body>区域中
DvrB(^.U <script language="JavaScript">
~3? jI pM
gGT#k#Th8m5` w function nextSize(i,incMethod,textLength) ee"W PN/q0gn
{
.K3O\6^D if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );
LE/[3o!k|G if (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));
yQYG|3X9Xo } w }
K$U fG];I5x p
f'LtVk!c function sizeCycle(text,method,dis)7hN^o2BJ
{
C3XWO%\FkB;}*_         output = "";
7q'RDXU2`         for (i = 0; i < text.length; i++)
L,Tg6~{@!~         {
6\(@|N"Cz}                 size = parseInt(nextSize(i +dis,method,text.length));
PQp.W$O`}x                 output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
D0C.R$Q2[6_@f         }
o:M'ZXp]:hp         theDiv.innerHTML = output;3QZ#G)ng&| L"A
}
9pvPfko
qsB)U,El function doWave(n)
a,p#VcE `aM {   
k _Cw oIx@$[r IzU'D         theText = "JavaScript";
,a_p!iD%T9WP W         sizeCycle(theText,1,n);
m({)k.rx         if (n > theText.length) {n=0}
"vy6s*h WCs'J         setTimeout("doWave(" + (n+1) + ")", 50);,mtvj8D0I0O(e R
}W#J2}nS/P~
</script>
r'`&J$^3MY)ZN <div ID="theDiv" align="center">X+W4RMw8h!D]s
!qF2Gx:wH%|Co5^
</div>
#`G'c#kp}2d%T
3Ka$h6|5`t b[ V3K;n/D
G%U&j:V#u)zM
|,w1U1w Ex$\
第二步:把如下代码加入<body>区域中<body onload=doWave(0);>

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.