css| Filter |
If you use your hand to quickly across a painting that has not yet dried, the picture will become blurred. The blur attribute under CSS will achieve this fuzzy effect.
Let's take a look at the expression of the Blur property:
Filter:blur (add=add,direction,strength=strength)
We see that the Blur property has three parameters: Add, direction, strength.
The add parameter has two parameter values: True and False. Specifies whether the picture is changed to a blur effect. The direction parameter is used to set the direction of the blur. The blur effect is done in a clockwise direction. where 0 degrees represent vertical upward, every 45 degrees per unit, the default value is 270 degrees to the left. The corresponding relation in the angle direction is shown in the following table:
The strength parameter value can only be specified using an integer, which represents how many pixels the width will be affected by the blur. The default value is 5 pixels.
Let's look at an example.
<ptml> <pead> <title>blur css</title> <script> function handlechange (obj) {with (obj.filters (0)) {if (strength<255) {strength +=2; Direction +=45; }} </script> </pead> <body> <p> </p> </b Ody></ptml>
[Ctrl + A Select all, hint: You can modify the code to run]
Does it look like a kaleidoscope, adding some JavaScript statements in this example, with the following code:
<title>blur css</title>
<script>
function HandleChange (obj)
//* sets a loop function HandleChange, the object is obj*//
{with (obj.filters (0))//*obj Filter Property *//
{if (strength<255)//* Set cycle conditions *//
{strength +=1;direction +=45;}
//* Each cycle once strength add 1,direction plus 45 degrees *//
}
}
</script>
<body>
<p>Style= "Filter:blur (strength=1)"
Onfilterchange= "HandleChange (This)" >
//* Import a picture, the initial blur property strength equals 1, and call the onfilterchange Letter
Number *//
</p>
</body>
Note: In JavaScript, the blur attribute is defined in this way:
[Oblurfilter=] object. Filters.blur
This example is a more complex example of the Blur attribute, and in the next section I'll introduce you to the two simpler blur property effects.
You can also set the font on the page by using the Blur property. If the Blur property add parameter value of the font is defined to be 1, the font effect is as follows (figure below):
How, is not some impressionist meaning, the implementation of this effect code is as follows:
<title>filter blur</title>
<style>//*css style definitions start *//
<!--
div{width:200;
Filter:blur (add=true,direction=90,strength=25);}
//* Set div style, filter blur properties *//
-->
</style>
<body>
<div style= "width:702 height:288" >
<p style= "Font-family:lucida handwirting italic;
Font-size:72;font-style:bold;color:rgb (55,72,145); ">
Leaf</p>
//* defines the font name, size, style, foreground color *//
</div>
</body>
We see strength set to 25, if the value of the larger, it will achieve very exaggerated effect, while the direction parameter value of 180, display the effect of the following figure:
Using the Blur property to set the font can achieve a lot of effects, the direction and strength to make changes, but also to achieve a variety of effects, you can modify their own try.