書式
obj = new fx.Text( element, { duration:msec, unit:fontUNIT, onComplete:msg } )
obj.custom(startSize, endSize)
obj : オブジェクト
element : ページ上のエレメント
msec : 処理完了までの時間 (ミリ秒)【省略可能】
fontUNIT : 文字の単位 (初期値はem) 【省略可能】
onComplete : 処理完了時に呼び出す処理【省略可能】
startSize : 開始フォントサイズ
endSize : 終了フォントサイズ
説明
文字サイズを段階的に変更するにはfx.Text()を使います。パラメータには文字サイズを変更するタグを指定します。文字サイズの変更はfx.Text()で生成したオブジェクトのcustom()メソッドで行います。パラメータには開始サイズと終了サイズを指定します。
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<link rel="stylesheet" href="main.css" type="text/css" media="all">
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript" src="moo.fx.js"></script>
<script type="text/javascript" src="moo.fx.pack.js"></script>
<script type="text/javascript"><!--
window.onload = function(){
divObj = new fx.Text("box", { duration:1000, unit:"px", onComplete:msg });
}
function changeTextSize(){
divObj.custom(1, 36); // 1px to 36px
}
function msg(){ alert("エフェクト終了"); }
// --></script>
</head>
<body>
<h1>文字サイズを変える</h1>
<form>
<input type="button" value="文字サイズを変更" onClick="changeTextSize()">
</form>
<div id="box">
ここの文字のサイズが変わります。<br>
文字の単位はemで指定します。
</div>
</body>
</html>