获得本站免费赞助空间请点这里
返回列表 发帖

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

脚本说明:   k! B8 ]4 h8 c2 s! y1 o
# O: V* @" X* v. E+ F0 x: |9 n
第一步:把如下代码加入<body>区域中
7 s- Z8 A4 Z" L* n( x% i- | <script language="JavaScript">
; X# \1 F/ R9 }6 g$ V* g; u% i" f- @/ n. Z3 I3 a, {2 t
function nextSize(i,incMethod,textLength)
/ T  N3 v+ a3 \8 [, w  D{/ t- `9 j- D; j
if (incMethod == 1) return (72*Math.abs( Math.sin(i/(textLength/3.14))) );
  H) T- V6 \: D; W; G0 Aif (incMethod == 2) return (255*Math.abs( Math.cos(i/(textLength/3.14))));% v6 G0 h) M& Y( M; E; C3 }
}
$ D# F2 @$ P5 j# [& A( r* _7 t; |
, @$ J1 U$ w7 `function sizeCycle(text,method,dis)2 v- x5 c) f. a, T7 j5 R
{( S# T, @; A! t; h
        output = "";
; g' b2 o; g1 c$ k+ I9 S        for (i = 0; i < text.length; i++)9 U4 O. o- D% i1 B" `) r  y
        {
5 F; s# n& W; j7 E8 k                size = parseInt(nextSize(i +dis,method,text.length));! p3 f) Y5 Y+ C* |* x$ T" @
                output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";3 v" ~. O8 m! N- k; V7 w) N
        }) `0 G" L* ~$ U! i
        theDiv.innerHTML = output;
1 f9 f1 f5 [# A* E}
8 B2 d" i. d. J& D$ C& ^& k0 `0 b
function doWave(n)
0 ~* g0 d' |1 v$ l{   
: p/ ^8 u. j: Q8 I& n' [) o        theText = "JavaScript";  X3 N& Z, ^4 `* Y' F
        sizeCycle(theText,1,n);
* t, F1 [' [! r3 p        if (n > theText.length) {n=0}
, k- J1 E- N% s- O* X" W        setTimeout("doWave(" + (n+1) + ")", 50);! ~9 G) [- c3 x$ {
}+ b1 I5 P, s: u) {# I2 P! O
</script>6 {4 G1 l& I' {3 p
<div ID="theDiv" align="center">
1 C5 A9 @4 }  }% ^- |
2 v- G& l, Q: u  U% |' ^  n. s</div>
1 U) C  u- {4 }! H. w! _. q# h
0 U" J) [1 m' F3 h0 f- c' X: V! e* ~. c5 X- C0 _% z
$ t+ b- _- R- A7 k

9 {( w( f% O5 m$ V$ b# i3 @3 E第二步:把如下代码加入<body>区域中<body onload=doWave(0);>

返回列表
【捌玖网络】已经运行: