-1

私はパワーポイントのようにテキスト効果を実行したいWebアプリを持っています。ラインはそのように左側から来ます。その方法は多くのリンクを試しましたが、得られませんでした

<HTML>
<Body>

 <p>This is the First Ans Last Game Of
 <p>The Tournament
</Body>
<HTML>

Javascript

function lib_bwcheck() {
    this.ver = navigator.appVersion;
    this.agent = navigator.userAgent;
    this.dom = document.getElementById ? 1 : 0;
    this.opera5 = this.agent.indexOf("Opera 5") > -1;
    this.ie5 = (this.ver.indexOf("MSIE 5") > -1 && this.dom && !this.opera5) ? 1 : 0;
    this.ie6 = (this.ver.indexOf("MSIE 6") > -1 && this.dom && !this.opera5) ? 1 : 0;
    this.ie4 = (document.all && !this.dom && !this.opera5) ? 1 : 0;
    this.ie = this.ie4 || this.ie5 || this.ie6;
    this.mac = this.agent.indexOf("Mac") > -1;
    this.ns6 = (this.dom && parseInt(this.ver) >= 5) ? 1 : 0;
    this.ns4 = (document.layers && !this.dom) ? 1 : 0;
    this.bw = (this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5);
    return this;
}
var bw = new lib_bwcheck()
var px = bw.ns4 || window.opera ? "" : "px";

function run() {
    var cx, cy, a, css, obj, nest, ooo;
    if ((document.all) && (!bw.opera5)) {
        movy = document.body.clientHeight - 64;
        movx = document.body.clientWidth - 50;
    } else {
        movx = window.innerWidth - 50;
        movy = window.innerHeight - 64;
    }
    for (var i = 0; i < maxitems; i++) {
        cx = Math.round(ox + i * syto / (maxitems - 1));
        if (ys[i] == 0) ys[i] = Math.round(Math.random() * syto + syto);
        //  if (ys[i]==0)    ys[i] = Math.round(Math.random()*100);
        if (cx > sxto || cx < sxfrom) {
            if (cx > sxto) cy = syfrom + (ys[i] - syfrom) * (cx - sxto) / (110 - sxto);
            else cy = syfrom + (ys[i] - syfrom) * (sxfrom - cx) / (sxfrom);
        } else {
            ys[i] = 0;
            cy = syfrom + Math.sin((cx - sxfrom) * Math.PI * yspeed / (sxto - sxfrom)) * ((cx - sxfrom) * (sdto - sdfrom) / (sxto - sxfrom) + sdfrom);
        }
        cx = Math.round(cx * movx / 100);
        cy = Math.round(cy * movy / 100);
        if (bw.ns4) {
            ooo = eval("document.s" + i);
            if (cx >= movx || cx <= 0) {
                ooo.visibility = "hidden";
                cx = 0;
            } else ooo.visibility = "visible";
            ooo.moveTo(cx, cy);
        } else {
            obj = "s" + i;
            nest = "";
            css = bw.dom ? document.getElementById(obj).style : bw.ie4 ? document.all[obj].style : bw.ns4 ? eval(nest + "document.layers." + obj) : 0;
            if (cx >= movx || cx <= 0) {
                css.visibility = "hidden";
                cx = 0;
            } else css.visibility = "visible";
            css.left = cx;
            css.top = cy;
        }
    }
    ox -= xspeed;
    if (ox < -syto) ox = 100;
    setTimeout("run()", tpause, "JavaScript");
}

var sxfrom = 20;
var sxto = 80;
var syfrom = 50;
var syto = 30;
var sdfrom = 20;
var sdto = 30;
var yspeed = 3;
var xspeed = 1;
var pcol = Number(255).toString(16);
var tpause = 20;
var schar = "JavaScriptSource";

var fontface = 0;
var fontsize = "6";
if (fontface == 0) fontface = 'Arial, Helvetica, sans-serif';
else if (fontface == 1) fontface = 'Times New Roman, serif';
else if (fontface == 2) fontface = 'Courier New, Courier, mono';
else if (fontface == 3) fontface = 'Georgia, Times New Roman, Times, serif';
else fontface = 'Verdana, Arial, Helvetica, sans-serif';

var maxitems = schar.length;
var t = 0;
t = pcol.length;
for (var i = 0; i < 6 - t; i++) pcol = '0' + pcol;

if ((document.all) && (!bw.opera5)) {
    movy = document.body.clientHeight - 64;
    movx = document.body.clientWidth - 50;
} else {
    movx = window.innerWidth - 50;
    movy = window.innerHeight - 64;
}

var ox = 100;
ys = new Array();
for (var i = 0; i < maxitems; i++) {
    if (bw.ns4) document.writeln("<layer id='s" + i + "'>");
    else document.writeln("<div id='s" + i + "' style='position:absolute; z-index:3;'>");
    document.writeln('<font color=#' + pcol + ' face="' + fontface + '" size="' + fontsize + '">' + schar.substr(i, 1) + '</font>');
    if (bw.ns4) document.writeln("</layer>");
    else document.writeln("</div>");
    ys[i] = 0;
}

setTimeout("run()", tpause, "JavaScript");​



//DO NOT MODIFY
 /*
 <APPLETINFO>
 appletname=jswavetext
 applettype=JAVASCRIPT
 created=1049050369870
 appletfilename=jswavetext1.js
 </APPLETINFO>
 <JAVASCRIPT>
  fontsize=6
  sxfrom=20
  sxto=80
  syfrom=50
  syto=30
  sdfrom=20
  sdto=30
  yspeed=3
  xspeed=1
  tpause=20
  schar=JSWaveText
  fontface=0
  pcol=255
  </JAVASCRIPT>
  <HTMLGENERATOR>
null</HTMLGENERATOR>
 */
4

1 に答える 1

1

コピーしたコードは古いものです。これを行うのに役立つCSSトランジションを見ていきます。アニメーションで遅延オプションを使用する場合、新しい位置を持つクラスを追加することで、ロード時にアニメーションをトリガーできます。

于 2012-04-18T06:42:31.713 に答える