欢迎来到忆约科技! 手机版
编程专栏
网络探索
科技频道
社会话题
美文鉴赏

波浪动态字体

编辑时间:2016年12月28日 00:17 作者:E小编

<html>




<body onload="startmotor(0)">

<script language="JavaScript1.2"> size = 15;
var speed_between_messages=1500  //in miliseconds


var tekst = new Array()

{
tekst[0] = "中国美食,尽在民以食为天!";

tekst[1] = "民以食为天 收集全国菜谱 美味小吃";

tekst[2] = "民以食为天  天天推荐新菜式";

tekst[3] = "欣赏美食  就来民以食为天";
}

var klaar = 0;
var s = 0;
var veran =0;
var tel = 0;

function bereken(i,Lengte)
{
return (size*Math.abs( Math.sin(i/(Lengte/3.14))) );
}


function motor(p)
{
var output = "";
for(w = 0;w < tekst[s].length - klaar+1; w++)
{
q = bereken(w/2 + p,16);
if (q > size - 0.5)
{klaar++;}
if (q < 5)
{tel++;
if (tel > 1)
{
tel = 0;
if (veran == 1)
{
veran = 0;
s++;
if ( s == tekst.length)
{s = 0;}
p = 0;
if (window.loop)
{clearInterval(loop)}
loop = motor();
}
}
}
output += "<font style='font-size: "+ q +"pt'>" +tekst[s].substring(w,w+1)+ "";
}
for(k=w;k<klaar+w;k++)

output += "<font style='font-size: " + size + "pt'>" +tekst[s].substring(k,k+1)+ "";
}
idee.innerHTML = output;
}

function startmotor(p){
if (!document.all)
return
var loop = motor(p); 
if (window.time)
{clearInterval(time)}
if (klaar == tekst[s].length)
{
klaar = 0;
veran = 1;
tel = 0;
var time = setTimeout("startmotor(" +(p+1) + ")", speed_between_messages);
}else
{
var time =setTimeout("startmotor(" +(p+1) + ")",50);
}

}

</script>
<div ID="idee">
</div>


</body>


</html>
二维码