応用例
(ソースはブラウザから直接ご覧ください。)
使い方: textAnim( 文字が入った配列 , 配列の要素数 , 時間(ミリ秒) );
HTML |
必須 |
必要に応じて変更 |
実際の使用例 |
<HTML> <HEAD> <TITLE>テキストアニメーション</TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- // Text Animation (c)1997 M.Okamura 7N1ANB (mailto:anb@y7.net) // free // // http://www.vector.co.jp/authors/VA008536/ var timerID = setTimeout("",0); var timer = 0; var ta; function textAnim( txt , number , interval ) { ta = txt; status = txt[ timer = ++timer % number ]; clearTimeout(timerID); timerID = setTimeout("textAnim( ta ," + number + "," + interval + ")" , interval ); } kao = new Array("(^_^)","( ^_)","( ^)","( )","( )","( )","(^ )","(_^ )"); wave = new Array("_____","\____"," ̄\___","/ ̄\__","_/ ̄\_","__/ ̄\","___/ ̄","____/"); moji = new Array("Okamura","oKamura","okAmura","okaMura","okamUra","okamuRa","okamurA","okamura"); tabaco = new Array("(-_-) ","(-_-)y- ","(-。-)y-・ ","(-。-)y-・゚ ","(-。-)y-・゚゜","(-_-)y- ゚゜","(-_-)y- ゜","(-_-)y- "); textAnim(kao,8,100); // --> </SCRIPT> </HEAD> <BODY> <INPUT TYPE="button" onClick="textAnim(kao,8,100);" VALUE="顔"> <INPUT TYPE="button" onClick="textAnim(wave,8,100);" VALUE="波"> <INPUT TYPE="button" onClick="textAnim(moji,8,200);" VALUE="文字"> <INPUT TYPE="button" onClick="textAnim(tabaco,8,500);" VALUE="タバコ"> <A HREF="mailto:anb@y7.net" onMouseOver="textAnim(kao,8,100);" onClick="return false;">顔</A> <A HREF="mailto:anb@y7.net" onMouseOver="textAnim(wave,8,100);" onClick="return false;">波</A> <A HREF="mailto:anb@y7.net" onMouseOver="textAnim(moji,8,200);" onClick="return false;">文字</A> <A HREF="mailto:anb@y7.net" onMouseOver="textAnim(tabaco,8,500);" onClick="return false;">タバコ</A> </BODY> </HTML>