159、文字跳舞效果

159、文字跳舞效果

脚本说明:

第一步:把如下代码加入<body>区域中

<SCRIPT language=JavaScript>

<!--

function MM_reloadPage(init) {

  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {

    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}

  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();

}

MM_reloadPage(true);

// -->

</SCRIPT>

<SCRIPT language=JavaScript>

<!--

function MM_timelinePlay(tmLnName, myID) {

 

  var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,propNum,theObj,firstTime=false;

  if (document.MM_Time == null) MM_initTimelines();

  tmLn = document.MM_Time[tmLnName];

  if (myID == null) { myID = ++tmLn.ID; firstTime=true;}

  if (myID == tmLn.ID) {

    setTimeout('MM_timelinePlay("'+tmLnName+'",'+myID+')',tmLn.delay);

    fNew = ++tmLn.curFrame;

    for (i=0; i<tmLn.length; i++) {

      sprite = tmLn[i];

      if (sprite.charAt(0) == 's') {

        if (sprite.obj) {

          numKeyFr = sprite.keyFrames.length; firstKeyFr = sprite.keyFrames[0];

          if (fNew >= firstKeyFr && fNew <= sprite.keyFrames[numKeyFr-1]) {

            keyFrm=1;

            for (j=0; j<sprite.values.length; j++) {

              props = sprite.values[j];

              if (numKeyFr != props.length) {

                if (props.prop2 == null) sprite.obj[props.prop] = props[fNew-firstKeyFr];

                else        sprite.obj[props.prop2][props.prop] = props[fNew-firstKeyFr];

              } else {

                while (keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]) keyFrm++;

                if (firstTime || fNew==sprite.keyFrames[keyFrm-1]) {

                  if (props.prop2 == null) sprite.obj[props.prop] = props[keyFrm-1];

                  else        sprite.obj[props.prop2][props.prop] = props[keyFrm-1];

        } } } } }

      } else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value);

      if (fNew > tmLn.lastFrame) tmLn.ID = 0;

  } }

}

 

function MM_timelineGoto(tmLnName, fNew, numGotos) {

 

  var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,lastKeyFr,propNum,theObj;

  if (document.MM_Time == null) MM_initTimelines();

  tmLn = document.MM_Time[tmLnName];

  if (numGotos != null)

    if (tmLn.gotoCount == null) tmLn.gotoCount = 1;

    else if (tmLn.gotoCount++ >= numGotos) {tmLn.gotoCount=0; return}

  jmpFwd = (fNew > tmLn.curFrame);

  for (i = 0; i < tmLn.length; i++) {

    sprite = (jmpFwd)? tmLn[i] : tmLn[(tmLn.length-1)-i];

    if (sprite.charAt(0) == "s") {

      numKeyFr = sprite.keyFrames.length;

      firstKeyFr = sprite.keyFrames[0];

      lastKeyFr = sprite.keyFrames[numKeyFr - 1];

      if ((jmpFwd && fNew<firstKeyFr) || (!jmpFwd && lastKeyFr<fNew)) continue;

      for (keyFrm=1; keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]; keyFrm++);

      for (j=0; j<sprite.values.length; j++) {

        props = sprite.values[j];

        if (numKeyFr == props.length) propNum = keyFrm-1

        else propNum = Math.min(Math.max(0,fNew-firstKeyFr),props.length-1);

        if (sprite.obj != null) {

          if (props.prop2 == null) sprite.obj[props.prop] = props[propNum];

          else        sprite.obj[props.prop2][props.prop] = props[propNum];

      } }

    } else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value);

  }

  tmLn.curFrame = fNew;

  if (tmLn.ID == 0) eval('MM_timelinePlay(tmLnName)');

}

 

function MM_initTimelines() {

    //MM_initTimelines() Copyright 1997 Macromedia, Inc. All rights reserved.

    var ns = navigator.appName == "Netscape";

    document.MM_Time = new Array(1);

    document.MM_Time[0] = new Array(8);

    document.MM_Time["Timeline1"] = document.MM_Time[0];

    document.MM_Time[0].MM_Name = "Timeline1";

    document.MM_Time[0].fps = 10;

    document.MM_Time[0][0] = new String("sprite");

    document.MM_Time[0][0].slot = 1;

    if (ns)

        document.MM_Time[0][0].obj = document["Layer1"];

    else

        document.MM_Time[0][0].obj = document.all ? document.all["Layer1"] : null;

    document.MM_Time[0][0].keyFrames = new Array(2, 6, 9, 12, 15, 18);

    document.MM_Time[0][0].values = new Array(4);

    document.MM_Time[0][0].values[0] = new Array(263,264,265,266,268,268,268,268,271,272,273,270,268,266,265,264,263);

    document.MM_Time[0][0].values[0].prop = "left";

    document.MM_Time[0][0].values[1] = new Array(101,95,89,82,76,87,98,108,100,93,86,91,96,100,102,104,106);

    document.MM_Time[0][0].values[1].prop = "top";

    if (!ns) {

        document.MM_Time[0][0].values[0].prop2 = "style";

        document.MM_Time[0][0].values[1].prop2 = "style";

    }

    document.MM_Time[0][0].values[2] = new Array(58,54,50,46,43,33,24,15,20,25,31,36,41,47,48,49,50);

    document.MM_Time[0][0].values[2].prop = "width";

    if (!ns)

        document.MM_Time[0][0].values[2].prop2 = "style";

    document.MM_Time[0][0].values[3] = new Array(52,51,50,49,48,46,44,42,43,44,45,46,47,49,48,47,47);

    document.MM_Time[0][0].values[3].prop = "height";

    if (!ns)

        document.MM_Time[0][0].values[3].prop2 = "style";

    document.MM_Time[0][1] = new String("sprite");

    document.MM_Time[0][1].slot = 2;

    if (ns)

        document.MM_Time[0][1].obj = document["Layer2"];

    else

        document.MM_Time[0][1].obj = document.all ? document.all["Layer2"] : null;

    document.MM_Time[0][1].keyFrames = new Array(2, 5, 9, 12, 15, 18);

    document.MM_Time[0][1].values = new Array(2);

    document.MM_Time[0][1].values[0] = new Array(323,323,322,322,322,322,322,323,324,326,328,326,324,322,322,322,323);

    document.MM_Time[0][1].values[0].prop = "left";

    document.MM_Time[0][1].values[1] = new Array(126,120,115,111,110,111,111,111,108,105,101,105,109,113,117,122,126);

    document.MM_Time[0][1].values[1].prop = "top";

    if (!ns) {

        document.MM_Time[0][1].values[0].prop2 = "style";

        document.MM_Time[0][1].values[1].prop2 = "style";

    }

    document.MM_Time[0][2] = new String("sprite");

    document.MM_Time[0][2].slot = 3;

    if (ns)

        document.MM_Time[0][2].obj = document["Layer4"];

    else

        document.MM_Time[0][2].obj = document.all ? document.all["Layer4"] : null;

    document.MM_Time[0][2].keyFrames = new Array(2, 5, 9, 12, 15, 18);

    document.MM_Time[0][2].values = new Array(3);

    document.MM_Time[0][2].values[0] = new Array(363,363,363,363,363,363,363,363,365,366,368,366,364,363,363,363,363);

    document.MM_Time[0][2].values[0].prop = "left";

    document.MM_Time[0][2].values[1] = new Array(131,123,115,107,113,119,125,131,122,111,101,113,124,131,131,131,131);

    document.MM_Time[0][2].values[1].prop = "top";

    if (!ns) {

        document.MM_Time[0][2].values[0].prop2 = "style";

        document.MM_Time[0][2].values[1].prop2 = "style";

    }

    document.MM_Time[0][2].values[2] = new Array(22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22);

    document.MM_Time[0][2].values[2].prop = "width";

    if (!ns)

        document.MM_Time[0][2].values[2].prop2 = "style";

    document.MM_Time[0][3] = new String("sprite");

    document.MM_Time[0][3].slot = 4;

    if (ns)

        document.MM_Time[0][3].obj = document["Layer5"];

    else

        document.MM_Time[0][3].obj = document.all ? document.all["Layer5"] : null;

    document.MM_Time[0][3].keyFrames = new Array(2, 5, 9, 12, 15, 18);

    document.MM_Time[0][3].values = new Array(2);

    document.MM_Time[0][3].values[0] = new Array(388,390,391,393,392,391,390,388,390,394,398,397,395,393,390,389,388);

    document.MM_Time[0][3].values[0].prop = "left";

    document.MM_Time[0][3].values[1] = new Array(131,128,124,121,124,126,129,131,119,103,86,105,122,136,137,134,131);

    document.MM_Time[0][3].values[1].prop = "top";

    if (!ns) {

        document.MM_Time[0][3].values[0].prop2 = "style";

        document.MM_Time[0][3].values[1].prop2 = "style";

    }

    document.MM_Time[0][4] = new String("sprite");

    document.MM_Time[0][4].slot = 5;

    if (ns)

        document.MM_Time[0][4].obj = document["Layer6"];

    else

        document.MM_Time[0][4].obj = document.all ? document.all["Layer6"] : null;

    document.MM_Time[0][4].keyFrames = new Array(2, 5, 9, 12, 15, 18);

    document.MM_Time[0][4].values = new Array(2);

    document.MM_Time[0][4].values[0] = new Array(413,413,413,413,413,413,413,413,415,416,418,416,414,413,413,413,413);

    document.MM_Time[0][4].values[0].prop = "left";

    document.MM_Time[0][4].values[1] = new Array(131,124,118,111,116,120,125,131,119,105,91,107,121,131,131,131,131);

    document.MM_Time[0][4].values[1].prop = "top";

    if (!ns) {

        document.MM_Time[0][4].values[0].prop2 = "style";

        document.MM_Time[0][4].values[1].prop2 = "style";

    }

    document.MM_Time[0][5] = new String("sprite");

    document.MM_Time[0][5].slot = 6;

    if (ns)

        document.MM_Time[0][5].obj = document["Layer7"];

    else

        document.MM_Time[0][5].obj = document.all ? document.all["Layer7"] : null;

    document.MM_Time[0][5].keyFrames = new Array(2, 5, 9, 12, 15, 18);

    document.MM_Time[0][5].values = new Array(2);

    document.MM_Time[0][5].values[0] = new Array(433,433,433,433,434,436,437,438,435,432,428,427,427,428,430,431,433);

    document.MM_Time[0][5].values[0].prop = "left";

    document.MM_Time[0][5].values[1] = new Array(131,131,131,131,128,125,120,116,118,120,121,117,112,106,114,122,131);

    document.MM_Time[0][5].values[1].prop = "top";

    if (!ns) {

        document.MM_Time[0][5].values[0].prop2 = "style";

        document.MM_Time[0][5].values[1].prop2 = "style";

    }

    document.MM_Time[0][6] = new String("behavior");

    document.MM_Time[0][6].frame = 19;

    document.MM_Time[0][6].value = "MM_timelineGoto('Timeline1','1')";

    document.MM_Time[0][7] = new String("sprite");

    document.MM_Time[0][7].slot = 7;

    if (ns)

        document.MM_Time[0][7].obj = document["Layer3"];

    else

        document.MM_Time[0][7].obj = document.all ? document.all["Layer3"] : null;

    document.MM_Time[0][7].keyFrames = new Array(2, 5, 9, 13, 16, 18);

    document.MM_Time[0][7].values = new Array(4);

    document.MM_Time[0][7].values[0] = new Array(458,458,458,458,457,457,457,458,463,468,473,478,468,459,453,454,458);

    document.MM_Time[0][7].values[0].prop = "left";

    document.MM_Time[0][7].values[1] = new Array(101,98,94,91,93,96,99,101,95,88,80,71,77,85,91,97,101);

    document.MM_Time[0][7].values[1].prop = "top";

    if (!ns) {

        document.MM_Time[0][7].values[0].prop2 = "style";

        document.MM_Time[0][7].values[1].prop2 = "style";

    }

    document.MM_Time[0][7].values[2] = new Array(31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31);

    document.MM_Time[0][7].values[2].prop = "width";

    if (!ns)

        document.MM_Time[0][7].values[2].prop2 = "style";

    document.MM_Time[0][7].values[3] = new Array(42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42);

    document.MM_Time[0][7].values[3].prop = "height";

    if (!ns)

        document.MM_Time[0][7].values[3].prop2 = "style";

    document.MM_Time[0].lastFrame = 19;

    for (i=0; i<document.MM_Time.length; i++) {

        document.MM_Time[i].ID = null;

        document.MM_Time[i].curFrame = 0;

        document.MM_Time[i].delay = 1000/document.MM_Time[i].fps;

    }

}

//-->

</SCRIPT>

<DIV id=Layer1

style="Z-INDEX: 1; LEFT: 264px; WIDTH: 58px; POSITION: absolute; TOP: 86px; HEIGHT: 52px"><FONT

face=隶书 color=#ff3333 size=7></FONT></DIV>

<DIV id=Layer2

style="Z-INDEX: 2; LEFT: 324px; WIDTH: 36px; POSITION: absolute; TOP: 112px; HEIGHT: 27px"><FONT

face=隶书 size=4><font color="#336600" size="5"></font></FONT></DIV>

<DIV id=Layer4

style="Z-INDEX: 4; LEFT: 363px; WIDTH: 25px; POSITION: absolute; TOP: 116px; HEIGHT: 22px"><FONT

face=隶书 size=4><font color="#FFFF00"></font></FONT></DIV>

<DIV id=Layer5

style="Z-INDEX: 5; LEFT: 388px; WIDTH: 1px; POSITION: absolute; TOP: 116px; HEIGHT: 1px"><FONT

face=隶书 size=4><FONT color=#ff33ff></FONT></FONT></DIV>

<DIV id=Layer6

style="Z-INDEX: 6; LEFT: 408px; WIDTH: 18px; POSITION: absolute; TOP: 116px; HEIGHT: 12px"><FONT

face=隶书 size=4><font color="#0000CC"></font></FONT></DIV>

<DIV id=Layer7

style="Z-INDEX: 7; LEFT: 428px; WIDTH: 21px; POSITION: absolute; TOP: 116px; HEIGHT: 15px"><FONT

face=隶书 size=4><font color="#FF6633"></font></FONT></DIV>

<DIV id=Layer3

style="Z-INDEX: 8; LEFT: 453px; WIDTH: 31px; POSITION: absolute; TOP: 91px; HEIGHT: 42px"><B><FONT

color=#00ff00 size=+5><I><font color="#009900"></font></I></FONT></B></DIV>

 

 

 

 

 

第二步:把<body>中的内容改为:

<body bgcolor="#fef4d9" onload="MM_timelinePlay('Timeline1')">

 

Write a comment

Comments: 0