Clever use of CSS MASK filter_Basic tutorial
The Mask filter can create a rectangular mask for the HTML element object on the web page. What is a mask? If you have used masks in Flash, you will know that it is like that. In fact, you can also understand masking in this way, which is equivalent to covering the object with a piece of colored cloth, but the content is dug out. If you still don’t understand, just look at the picture below and let me explain it to you in detail.
Figure 1 Mask filter effect 1
Use such a dark color in the mask filter above , mainly so that you can clearly see the effect. Let's take a look at the parameters of the mask filter: It has only one parameter Color, which is the color value of the mask in the format of #RRGGBB. You just need to choose a suitable color for it in DW3. For example, the mask filter code above is: .mask1 { filter:mask(color=#00ff00) }. In the following example, you will see, In fact, the color of the filter is not the main thing, the key is the color of the background.
Next we use the mask filter to create several special effects:
1. Colorful text
Figure 2 mask Filter Effect 2
How about the above effect? It’s not bad! It's a bit like an image, isn't it? This is the effect of the mask filter. A white filter is used here, and its code is: .mask1 { filter:mask(color=#ffffff) }. The colorful text color is actually the color of the background. The production method is also very simple, just insert a 1*1 table, add a multi-colored background to the table, enter text in the table, load a mask filter to the cell, and you are done. Not difficult, right? !
2. Searchlight animation effect
The following searchlight effect requires a lot of effort to use Flash, but I never thought it could be done using CSS filters! Since the searchlight effect is dynamic, I can only capture two process pictures for you to see. If you want to see the dynamic effect, then you can make one according to what I said or go to my house (http://fym888.go.163.com) look.
Figure 3 Searchlight animation effect 1
Figure 4 Searchlight animation effect 2
Here is the production method:
This effect is a little more complicated than the above example, but it only requires a few more mouse clicks.
1. Insert a layer, which I call the "parent layer". This layer is used to place the content (text or pictures) to be displayed. Insert a layer on top of this layer, which I call a sublayer, and it's mainly used to create a masking effect.
2. Set the display window on the property panel of the parent layer, that is, set the "Clip" attribute of the layer. In this attribute, relative coordinates are used, where: L and T are the coordinates of the upper left corner; R and B is the coordinate of the lower right corner. Subsequent sublayers will only be displayed in the window you set.The set layer attribute parameter panel is as shown below:
Figure 5 Layer attribute panel
Here I am The parent layer is "Layer4". I use the entire parent layer as the display window here, that is, it is visible when the child layer moves to the parent layer, and is not visible outside the parent layer.
3. We insert a circular image with a transparent background on the sub-layer. The main purpose of using a circular image here is that the projection of the searchlight is like a circle. In addition, the image part outside the circle must be transparent, otherwise the visible It will be a rectangular box moving. Then load a mask filter with the same color as the background color of the parent layer on the child layer, and enlarge the child layer so that it can completely cover the content of the parent layer, so that the content on the parent layer in the browser will only be circular. That part of the image is visible, which is exactly what we want.
4. Of course, if you want to produce the effect of a searchlight, you need to make the circular area move. This requires using the Timeline function of Dreamweaver. In DW3, first drag to the sub-layer so that the picture on it just covers the head of the parent layer content. Press "Ctrl F9" to bring up the timeline panel, drag the sub-layer to the timeline panel, and drag the last frame to 100 frames, then insert a key frame at the 50th frame, and overlap the sub-layer picture with the tail of the parent layer content, select "Loop" (loop play) and "Auto" (automatic play) on the timeline panel, everything OK.
A complex animation is completed. Press F12 to take a look. Isn’t it cool? !

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The Svelte transition API provides a way to animate components when they enter or leave the document, including custom Svelte transitions.

If you’ve recently started working with GraphQL, or reviewed its pros and cons, you’ve no doubt heard things like “GraphQL doesn’t support caching” or

How much time do you spend designing the content presentation for your websites? When you write a new blog post or create a new page, are you thinking about

With the recent climb of Bitcoin’s price over 20k $USD, and to it recently breaking 30k, I thought it’s worth taking a deep dive back into creating Ethereum

No matter what stage you’re at as a developer, the tasks we complete—whether big or small—make a huge impact in our personal and professional growth.

It's out! Congrats to the Vue team for getting it done, I know it was a massive effort and a long time coming. All new docs, as well.

I'd say "website" fits better than "mobile app" but I like this framing from Max Lynch:

I was just chatting with Eric Meyer the other day and I remembered an Eric Meyer story from my formative years. I wrote a blog post about CSS specificity, and
