Why can the barrage of station B not block characters?

When watching the video at station B that day, I accidentally found that the subtitles were cut when they encountered the characters, and they would not block the characters. I thought it was amazing, so I decided to find out.

High-end effects often only need to be realized in the most simple way. After two hours of work, Master Chen opened the F12 and suddenly became enlightened. A picture + an attribute, get it directly.

image.png

image.png

In order to prove my idea, I decided to write a demo myself

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <style>
    .video {
      width: 668px;
      height: 376px;
      position: relative;
      -webkit-mask-image: url("mask.svg");
      -webkit-mask-size: 668px 376px;
    }
    .bullet {
      position: absolute;
      font-size: 20px;
    }
  </style>
</head>
<body>
<div class="video">
  <div class="bullet" style="left: 100px; top: 0;">元芳,你怎么看</div>
  <div class="bullet" style="left: 200px; top: 20px;">你难道就是传说中的奶灵</div>
  <div class="bullet" style="left: 300px; top: 40px;">你好,我是胖灵</div>
  <div class="bullet" style="left: 400px; top: 60px;">这是第一集,还没有舔灵</div>
</div>
</body>
</html>
复制代码

The effect is this

image.png

Add a red background to see it clearly

image.png

So far, we have realized the same type of bullet screen at station B that does not block characters. As for how this picture came from, it must be recognized and generated by AI. A picture is only one or two K, and loading many pictures at one time will not cause a lot of burden.

Finally, let's take a look at this magical css property

developer.mozilla.org/en-US/docs/…

Experimental:  This is an experimental feature

Therefore, it can be used as a bright spot when developing requirements, but it cannot be strongly dependent on this property for requirements.

It also has a series of properties, if you are interested, you can try them one by one.

image.png

Guess you like

Origin juejin.im/post/7141012605535010823