A Pen by JowayYoung on CodePen.
Created
November 3, 2019 12:18
-
-
Save mqxu/398e36deaeab3488ac14fe06bbb43f23 to your computer and use it in GitHub Desktop.
【iCSS:图形】使用mask雕刻镂空背景
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="bruce pr flex-ct-x"> | |
<div class="mask-layer"></div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$mask-bg: "https://yangzw.vip/static/codepen/mask-bg.jpg"; | |
$mask-text: "https://yangzw.vip/static/codepen/mask-text.jpg"; | |
$logo: "https://yangzw.vip/static/codepen/logo-netease.svg"; | |
.bruce { | |
overflow: hidden; | |
&::after { | |
position: absolute; | |
left: -20px; | |
right: -20px; | |
top: -20px; | |
bottom: -20px; | |
background: url($mask-bg) no-repeat center/cover; | |
filter: blur(10px); | |
content: ""; | |
} | |
} | |
.mask-layer { | |
position: relative; | |
z-index: 9; | |
width: 600px; | |
height: 300px; | |
background: url($mask-text) left center/150% auto; | |
mask: url($logo) center/cover; | |
animation: move 10s infinite; | |
} | |
@keyframes move { | |
0% { | |
background-position-x: 0; | |
} | |
50% { | |
background-position-x: 100%; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="https://yangzw.vip/static/css/reset.css" rel="stylesheet" /> | |
<link href="https://yangzw.vip/static/css/main.css" rel="stylesheet" /> | |
<link href="https://yangzw.vip/static/css/theme.scss" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment