処理を停止させる

書式

bytefx.clear(element)

element : ページ上のエレメント


clearInterval(element.bytefx[name])

element : ページ上のエレメント
name : 停止させたい処理の名前

説明

 処理を停止させるにはbytefx.clear()を使います。このメソッドで停止されるのはcolor, fade, move, size処理になります。bytefx.clear()では、これら全ての処理が停止されます。個別に処理を停止させるにはエレメントのbytefx[]で停止させたい処理の名前 (color, fade, move, sizeのいずれか) を指定しclearInterval()メソッドのパラメータとして指定します。

サンプルコード [実行]

<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="bytefx_OS.js"></script>
<script type="text/javascript"><!--
function fademove(){
bytefx.color(document.getElementById("box"), "backgroundColor", "#ff0000", "#0000ff", 1);
bytefx.move(document.getElementById("box"), {x:300, y:250}, 0.1);
}
function fadestop(){
var obj = document.getElementById("box");
clearInterval(obj.bytefx["move"]);
}
function allstop(){
bytefx.clear(document.getElementById("box"));
}
// --></script>
</head>
<body>
<h1>処理を停止させる</h1>
<form>
<input type="button" value="カラー変更&移動開始" onClick="fademove()">
<input type="button" value="移動処理のみ停止" onClick="fadestop()">
<input type="button" value="全て停止" onClick="allstop()">
</form>
<div id="box">bytefxサンプル</div>
</body>
</html>