Ways to use CSS filters

Source: Internet
Author: User
Tags filter range
css| Filter

There are two ways to use the specific application:

1, first define a good CSS, and then in the page need to use the predefined CSS, in fact, the CSS Settings dialog box has been in advance the syntax of these filters have been set up, we just fill in the appropriate specific parameters can be:

2. Write CSS filter code directly on HTML control elements that support CSS filter effects.

A.alpha Filter

The Alpha attribute mixes a target element with the background. Designers can specify values to control the degree of mixing. This "mixed with the background" is popularly said to be 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)}

Filter:filtername (Parameters) is filter: Filter name (parameters)

Filter effects Function description
Alpha Set different transparency change effects
Blur Create a Blur effect
DropShadow Creates an offset image contour, which casts a shadow
Fliph Flip horizontally
Flipv Flip vertically
Glow Adds color light to the bounds of the object
Gray Display a picture in grayscale
Invert The color, saturation and brightness values are completely reversed, similar to the film effect
Light Light projection on an object
Mask Create a color transparent mask for an object
Shadow Shadow effect of creating outlines for an object
Wave Use sine wave to disrupt pictures in X and y axes
Xray Show only the outline of an object

The parameter meanings are as follows:

Parameters Description
Opacity Transparency. The default range is from 0 to 100, and they are actually in the form of percentages. In other words, 0 represents total transparency, and 100 represents total opacity.
Finishopacity is an optional parameter, and if you want to set the transparency effect of a gradient, you can use them to specify the transparency at the end. The range is also 0 to 100.
Style To specify the shape characteristics of a transparent region:
0 represents a unified shape
1 representing linear
2 represents radial
3 Represents a rectangle
StartX The x-coordinate at the beginning of the gradient transparency effect.
Starty The y-coordinate at the beginning of the gradient transparency effect.
Finishx The x-coordinate at the end of the gradient transparency effect.
Finishy The y-coordinate at the end of the gradient transparency effect.
B. Blur FilterThe picture becomes blurred when you use your finger to quickly cross a picture that is not yet dry. "Blur" is to produce the same blur effect.

Blur filter syntax 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 picture has been changed to an impressionist blur effect. The blur effect is in the clockwise direction,
This is a Boolean value: Ture (default) or False
Direction This parameter is used to set the direction of the blur.
0 degrees represents vertical upward, each 45 degree is one unit, the default value is 270 degrees to the left
Strength Only integers can be used to specify how many pixels the width will be affected by the blur, and the default is 5 pixels.

C. DropShadow Filter

"Dropshaow", as the name implies is to add object shadow effect. Its working principle is to create an offset, plus color.

DropShadow Filter Grammar {Filter:dropshadow
(color=color,offx=ofx,offy=offy,positive=positive)}

The parameter meaning is as follows:

Parameters Description
Color Represents the color of a projected shadow
Offx The offset of the shadow in the x direction
Offy The offset of the Y-direction shadow
Positive Boolean value
If True (non 0), create a visible projection for any non-transparent pixel
If Fasle (0), create a transparent effect for the transparent pixel portion

D. Fliph, FLIPV filter

FLIPH filter to achieve horizontal inversion
fliph Filter syntax {Filter:filph}

FLIPV filter to achieve vertical inversion

FLIPV Filter syntax {FILTER:FILPV}
E. Fliph, FLIPV filter

FLIPH filter to achieve horizontal inversion
fliph Filter syntax {Filter:filph}

FLIPV filter to achieve vertical inversion

FLIPV Filter syntax {FILTER:FILPV}
F. Glow Filter

When you use the "glow" attribute on an object, the edge of the object produces a glow-like effect.

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

The parameter meaning is as follows:

Parameters Description
Color Specify the color of the glow
Strength Strength, any integer value from 1 to 255, specifying the intensity and range of the glow color.
G. Gray, Invert,xray filter

Using the gray filter to turn a picture into a grayscale image, the syntax is simple:

Gray Filter Grammar {Filter:gray}
H. Gray, Invert,xray filter

Using the gray filter to turn a picture into a grayscale image, the syntax is simple:

Gray Filter Grammar {Filter:gray}
I. Mask Filter
Mask Filter Grammar {Filter:mask (Color=color)}

Use the "MASK" property to create an object covering the surface of the film, the effect is like wearing tinted glasses to look at objects.
J.

Light Filter

Light Filter Grammar {Filter:light}

This property simulates the projection effect of the light source. Once you have defined the LIGHT Filter property for an object, you can call its method to set or change the property. The available methods for "LIGHT" are:

Parameters Description
Addambient Join the surround Light
Addcone Add Cone Light
Addpoint Add Point Light
Changcolor Change the color of light
Changstrength Change the intensity of the light source
Clear Clear all the lights
Movelight Moving Light

K.Shadow Filter

Shadow Filter
Grammar
{Filter:shadow (color=color,direction=direction)}

Use the "Shadow" property to create a projection of the object in the specified direction, color is the projection color, and the direction is the direction to set the projection. 0 degrees represent vertical upward, and then each 45 degree is a unit. Its default value is 270 degrees to the left.
L.

Wave Filter

Wave Filter
Grammar
{Filter:wave (Add=add,freq=freq,
Lightstrength=strength,
Phase=phase,strength=strength)}

Parameters Description
Wave The object is disturbed by the vertical waveform style.
The default is TRUE (non 0)
ADD Do you want to disrupt the object in a waveform style?
Freq The frequency of the ripple, which specifies how many complete ripples are required to be generated on the object altogether.
Lightstrength can enhance the effect of the ripple, the range 0----100
PHASE Set the offset of the sine wave
Strength Amplitude size

M.Gray, Invert,xray filter

Using the gray filter to turn a picture into a grayscale image, the syntax is simple:

Gray Filter Grammar {Filter:gray}



Related Article

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.