CSS Filter usage

Source: Internet
Author: User
Filter: filtername (parameters): filter: Filter Name (parameter)

Filter Effect Function Description
Alpha Set different transparency changes
Blur Create a blur effect
Dropshadow Creates an offset image profile, that is, a projection shadow.
Fliph Horizontal flip
Flipv Vertical flip
Glow Adds color light effects to the boundaries of objects.
Gray Display images in grayscale format
Invert Completely invert the color, saturation, and brightness values, similar to the negative effect.
Light Light Projection on an object
Mask Creates a color transparent mask for an object.
Shadow Create a shadow effect for an object
Wave Use a sine wave to disrupt the image on the X and Y axes.
Xray Show only the outlines of Objects


Specific Application
There are two methods:

1. Define CSS first, and then use pre-defined CSS on the objects required on the page. In fact, the syntax of these filters has been set in the CSS Settings dialog box in advance, we only need to fill in the appropriate specific parameters:

2. Write CSS Filter Code directly on HTML control elements that support CSS Filter effects.

A.Alpha Filter

The "Alpha" attribute is to mix a target element with a background. The designer can specify a value to control the degree of mixing. In general, this "mixed with the background" is the transparency of an element. By specifying coordinates, you can specify the transparency of different ranges.

Alpha filter syntax {Filter: alpha (opacity = opacity, finishopacity = finishopacity,
Style = style, startx = startx,
Starty = starty, finishx = finishx, finishy = finishy )}

The parameter meanings are as follows:

Parameters Description
Opacity Transparency. The default range is from 0 to 100. They are actually percentages. That is to say, 0 indicates completely transparent, and 100 indicates completely opaque.
Finishopacity Is an optional parameter. If you want to set the transparency of the gradient, you can use them to specify the transparency at the end. The range is also 0 to 100.
Style Shape features of the specified transparent area:
0 represents a unified shape
1 represents linear
2 represents radiation
3 represents a rectangle
Startx X coordinate at the beginning of the gradient transparency effect.
Starty Y coordinate at the beginning of the gradient transparency effect.
Finishx X coordinate of the end of the gradient transparency effect.
Finishy The Y coordinate at the end of the gradient transparency effect.

B.Blur filterYou can use your fingers to quickly draw an image that is not completely dry, and the image will become blurred ." Blur is the same blur effect.

Blur filterSyntax HTML: {filter: blur (add = add, direction = direction,
Strength = strength )}
Script Language: [oblurfilter =] object. Filters. blur

The parameter meanings are as follows:

Parameters Description
Add It specifies whether the image is changed to the fuzzy effect of the image. The Blur effect is performed clockwise,
This is a Boolean value: true (default) or false
Direction This parameter is used to set the fuzzy direction.
0 degrees indicates vertical up, every 45 degrees is a unit, the default value is 270 degrees to the left
Strength You can only specify the integer to indicate how many pixels of width will be blurred. The default value is 5 pixels.

C.Dropshadow Filter

"Dropshaow", as its name implies, is the shadow effect of adding objects. The working principle is to create an offset and add color.

Dropshadow FilterSyntax {Filter: dropshadow
(Color = color, offx = ofx, offy = offy, positive = positive )}

The parameter description is as follows:

Parameters Description
Color The color of the shadow.
Offx Offset of the shadow in the X direction
Offy Offset of the shadow in the Y direction
Positive Boolean Value
If it is true (not 0), a visible projection is created for any non-transparent pixel.
If it is fasle (0), a transparent effect is created for the transparent pixel part.

D.Fliph and flipv Filters

Fliph filter implements horizontal Inversion

Fliph FilterSyntax {Filter: filph}

The flipv filter implements vertical inversion.

Flipv FilterSyntax {Filter: filpv}

E.Fliph and flipv Filters

Fliph filter implements horizontal Inversion

Fliph FilterSyntax {Filter: filph}

The flipv filter implements vertical inversion.

Flipv FilterSyntax {Filter: filpv}

F.Glow filter

After you use the "Glow" attribute for an object, the edge of the object will produce a similar luminous effect.

Glow filterSyntax {Filter: glow (color = color, strength )}

The parameter description is as follows:

Parameters Description
Color Specify the luminous color
Strength Intensity, an integer between 1 and 255, specifying the intensity and range of luminous colors.

G.Gray, invert, Xray Filters

The gray filter can be used to convert an image into a grayscale image. The syntax is simple:

Gray FilterSyntax {Filter: Gray}

H.Gray, invert, Xray Filters

The gray filter can be used to convert an image into a grayscale image. The syntax is simple:

Gray FilterSyntax {Filter: Gray}

I.Mask filter

Mask filterSyntax {Filter: mask (color = color )}

Using the "Mask" attribute, you can create a film covering the surface for the object. The effect is the same as watching the object with colored glasses.
J.

Light Filter

Light FilterSyntax {Filter: Light}

This property simulates the projection effect of the light source. Once the "light" filter attribute is defined for an object, you can call its "method" to set or change the attribute. Available Methods for "light" include:

Parameters Description
Addambient Add surrounded Light Source
Addcone Add conical Light Source
Addpoint Add a light source
Changcolor Change the color of light
Changstrength Changes the intensity of the light source.
Clear Clear all light sources
Movelight Mobile Light Source

K.Shadow Filter

Shadow Filter
Syntax
{Filter: Shadow (color = color, direction = direction )}

You can use the "shadow" attribute to create an object projection in the specified direction. color is the projection color, and direction is the projection direction. Where 0 degrees indicates vertical up, and then every 45 degrees is a unit. The default value is 270 degrees to the left.
L.

Wave Filter

Wave Filter
Syntax
{Filter: Wave (add = add, freq = freq,
Lightstrength = strength,
Phase = phase, strength = strength )}

Parameters Description
Wave Disrupt the object according to the vertical waveform style.
The default value is true (not 0)
Add Whether to disturb the object according to the waveform Style
Freq The ripple frequency, that is, the total number of complete ripple to be generated on the object.
Lightstrength It can enhance the effect of Ripple light and shade in the range of 0----100
Phase Set the offset of the sine wave.
Strength Amplitude

M.Gray, invert, Xray Filters

The gray filter can be used to convert an image into a grayscale image. The syntax is simple:

Gray FilterSyntax {Filter: Gray}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.