| IE6.0 | IE5.5 | IE5.0 | IE4.0 | |||||
| DirectXを使わないフィルタ効果 | ||||||||
| 本書「フィルタで画像や文字に効果をつけよう」では、DirectXを使ったフィルタを紹介しましたが、実はInternet Explorer4.0でもフィルタが使えます。ここではそれを紹介しましょう。 | ||||||||
| 解説 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
基本的にCSSの一つですので、<div>タグや<span>タグを使った書式は、以下のようになります。他の書式はサンプルで確認してください。
<div style="filter:フィルタ名 ( 属性 = 値 , 属性 = 値 ,属性 = 値 …)"> : : </div>各フィルタの属性や値は、以下の表のようになります。
以下の表はLightフィルタが取る属性と値です。具体的な書式はサンプルで確認してください。
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Sample-1 Alphaフィルタ (Alpha.html) | ||
<html>
<head>
<title>Alpha</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<style type="text/css">
<!--
.filter_typ { filter: Alpha
( Opacity = 10,
FinishOpacity = 100,
Style = 2,
StartX = 0,
StartY = 10,
FinishX = 100,
FinishY = 80 ) }
body { text-align: center}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<img src="1.jpg" width="200" height="150"><br>
↑元画像 効果付↓<br>
<img src="1.jpg" width="200" height="150" class="filter_typ">
</body>
</html>
|
||
| Sample-2 Blurフィルタ (Blur.html) | ||
<html>
<head>
<title>Blur</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<style type="text/css">
<!--
.filter_typ { filter: Blur
( Add = true,
Direction = 135,
Strength = 100 ) }
body { text-align: center}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<img src="1.jpg" width="200" height="150"><br>
↑元画像 効果付↓<br>
<img src="1.jpg" width="200" height="150" class="filter_typ">
</body>
</html>
|
||
| Sample-3 Chromaフィルタ (Chroma.html) | ||
<html>
<head>
<title>Chroma</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<style type="text/css">
<!--
.filter_typ { filter: Chroma( Color=#ff0000 ) }
body { text-align: center}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<img src="2.gif" width="180" height="180"><br>
↑元画像 効果付↓<br>
<img src="2.gif" width="180" height="180" class="filter_typ">
</body>
</html>
|
||
| Sample-4 DropShadowフィルタ (DropShadow.html) | ||
<html>
<head>
<title>DropShadow</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<style type="text/css">
<!--
.filter_typ { padding:20px;
width:100%;
filter:DropShadow
( Color = #000000,
OffX = 5,
OffY = 5,
Positive = true ) }
body { text-align: center}
-->
</style>
</head>
<body bgcolor="#66FFFF" text="#000000">
<img src="1.jpg" width="200" height="150"><br>
↑元画像 効果付↓<br>
<span class="filter_typ"><img src="1.jpg" width="200" height="150"></span>
</body>
</html>
|
||
| Sample-5 FlipHフィルタ (FlipH.html) | ||
<html>
<head>
<title>FlipH</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<style type="text/css">
<!--
.filter_typ { filter: FlipH }
body { text-align: center}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<img src="1.jpg" width="200" height="150"><br>
↑元画像 効果付↓<br>
<img src="1.jpg" width="200" height="150" class="filter_typ">
</body>
</html>
|
||
| Sample-6 FlipVフィルタ (FlipV.html) | ||
<html>
<head>
<title>FlipV</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<style type="text/css">
<!--
.filter_typ { filter: FlipV }
body { text-align: center}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<img src="1.jpg" width="200" height="150"><br>
↑元画像 効果付↓<br>
<img src="1.jpg" width="200" height="150" class="filter_typ">
</body>
</html>
|
||
| Sample-7 Glowフィルタ (Glow.html) | ||
<html>
<head>
<title>Glow</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<style type="text/css">
<!--
.filter_typ { padding:2px;
width:50%;
filter: Glow
( Color = #FF0000,
Strength = 100 ) }
body { text-align: center}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<img src="1.jpg" width="200" height="150"><br>
↑元画像 効果付↓<br>
<div class="filter_typ"><img src="1.jpg" width="200" height="150"></div>
</body>
</html>
|
||
| Sample-8 Grayフィルタ (Gray.html) | ||
<html>
<head>
<title>Glow</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<style type="text/css">
<!--
.filter_typ { padding:2px;
width:50%;
filter: Glow
( Color = #FF0000,
Strength = 100 ) }
body { text-align: center}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<img src="1.jpg" width="200" height="150"><br>
↑元画像 効果付↓<br>
<div class="filter_typ"><img src="1.jpg" width="200" height="150"></div>
</body>
</html>
|
||
| Sample-9 Invertフィルタ (Invert.html) | ||
<html>
<head>
<title>Invert</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<style type="text/css">
<!--
.filter_typ { filter: Invert }
body { text-align: center}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<img src="1.jpg" width="200" height="150"><br>
↑元画像 効果付↓<br>
<img src="1.jpg" width="200" height="150" class="filter_typ">
</body>
</html>
|
||
| Sample-10 Lightフィルタ (Light.html) | ||
<html>
<head>
<title>Light</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<style type="text/css">
<!--
.filter_typ { filter: Light }
body { text-align: center }
-->
</style>
<script language="JavaScript">
<!--
function fliter_addAmbient(){
fliter_Clear();
sally_pic.filters.Light.addAmbient
( 255 , 0 , 0 , 50 );
}
function fliter_AddCone(){
fliter_Clear();
sally_pic.filters.Light.addCone
( 10 , 10 , 0 , 100 , 100 , 255 , 255 , 255 , 50 , 30 );
}
function fliter_addPoint(){
fliter_Clear();
sally_pic.filters.Light.addPoint
( 100 , 100 , 100 , 255 , 0 , 0 , 50 );
}
function fliter_ChangeColor(clr){
var r = 0;
var g = 0;
var b = 0;
if(clr == "red"){
r = 255;
}
if(clr == "green"){
g = 255;
}
if(clr == "blue"){
b = 255;
}
sally_pic.filters.Light.ChangeColor
( 0 , r , g , b , true );
}
function fliter_ChangeStrength(){
sally_pic.filters.Light.ChangeStrength
( 0 , 10 , false );
}
function fliter_Clear(){
sally_pic.filters.Light.Clear();
}
function fliter_MoveLight(){
sally_pic.filters.Light.MoveLight
( 0 , 200 , 200 , 200 , true );
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" onLoad="fliter_AddCone()">
<img id="sally_pic" src="1.jpg" width="200" height="150" class="filter_typ">
<form>
<table border="1" cellpadding="0" cellspacing="0">
<tr bgcolor="#00FFFF">
<td align="center">メソッド名</td>
<td align="center">使い方</td>
</tr>
<tr>
<td align="center">
<input type="button" value="addAmbient" onClick="fliter_addAmbient()">
</td>
<td>クリックしてみてください。</td>
</tr>
<tr>
<td align="center">
<input type="button" value="AddCone" onClick="fliter_AddCone()">
</td>
<td>クリックしてみてください。</td>
</tr>
<tr>
<td align="center">
<input type="button" value="addPoint" onClick="fliter_addPoint()">
</td>
<td>クリックしてみてください。</td>
</tr>
<tr>
<td align="center">
<select name="select" onChange="fliter_ChangeColor(this.value)">
<option value="0" selected>選んで下さい(ChangeColor)</option>
<option value="red">赤</option>
<option value="green">緑</option>
<option value="blue">青</option>
</select>
</td>
<td>addAmbientやAddConeやaddPointをクリックした後に選択すると、
色を変えることができます。</td>
</tr>
<tr>
<td align="center">
<input type="button" value="ChangeStrength" onClick="fliter_ChangeStrength()">
</td>
<td>addAmbientやAddConeやaddPointをクリックした後に、
ここをクリックすると、光の強さを変えることができます。
押す回数で光の強さも変化します。</td>
</tr>
<tr>
<td align="center">
<input type="button" value="Clear" onClick="fliter_Clear()">
</td>
<td>効果をキャンセルできます。</td>
</tr>
<tr>
<td align="center">
<input type="button" value="MoveLight" onClick="fliter_MoveLight()">
</td>
<td>addPointをクリックした後にクリックすると、光を移動できます。</td>
</tr>
</table>
</form>
</body>
</html>
|
||
| Sample-11 Maskフィルタ (Mask.html) | ||
<html>
<head>
<title>Mask</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<style type="text/css">
<!--
.filter_typ { filter: Mask( Color = #ffff00 ) }
body { text-align: center}
-->
</style>
</head>
<body bgcolor="#0000FF" text="#000000">
<img src="3.gif" width="180" height="180"><br>
↑元画像 効果付↓<br>
<img src="3.gif" width="180" height="180" class="filter_typ">
</body>
</html>
|
||
| Sample-12 Shadowフィルタ (Shadow.html) | ||
<html>
<head>
<title>Shadow</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<style type="text/css">
<!--
.filter_typ { padding: 20px;
width:100%;
filter: Shadow( Color = #000000, Direction = 135 ) }
body { text-align: center}
-->
</style>
</head>
<body bgcolor="#33FF66" text="#000000">
<img src="1.jpg" width="200" height="150"><br>
↑元画像 効果付↓<br>
<span class="filter_typ"><img src="1.jpg" width="200" height="150"></span>
</body>
</html>
|
||
| Sample-13 Waveフィルタ (Wave.html) | ||
<html>
<head>
<title>Wave</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<style type="text/css">
<!--
.filter_typ { filter: Wave
( Add=true,
Freq=10,
LightStrength=80,
Phase=25,
Strength=90 ) }
body { text-align: center}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<img src="1.jpg" width="200" height="150"><br>
↑元画像 効果付↓<br>
<img src="1.jpg" width="200" height="150" class="filter_typ">
</body>
</html>
|
||
| Sample-14 XRayフィルタ (XRay.html) | ||
<html>
<head>
<title>XRay</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<style type="text/css">
<!--
.filter_typ { filter: Xray }
body { text-align: center}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<img src="1.jpg" width="200" height="150"><br>
↑元画像 効果付↓<br>
<img src="1.jpg" width="200" height="150" class="filter_typ">
</body>
</html>
|
||
| 参照 | ||
| 詳細については、マイクロソフトのリファレンスページ(日本語)を参照してください。 <http://www.microsoft.com/japan/developer/library/jpisdk/dhtml/content/filters.htm> |
||