{"id":3325,"date":"2024-11-10T08:59:14","date_gmt":"2024-11-10T00:59:14","guid":{"rendered":"https:\/\/fwq.ai\/blog\/3325\/"},"modified":"2024-11-10T08:59:14","modified_gmt":"2024-11-10T00:59:14","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8-css-mask-composite-%e4%bc%98%e9%9b%85%e5%9c%b0%e8%a7%a3%e5%86%b3%e7%bc%ba%e5%8f%a3%e9%97%ae%e9%a2%98%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/3325\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528 CSS mask-composite \u4f18\u96c5\u5730\u89e3\u51b3\u7f3a\u53e3\u95ee\u9898\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173103032738383.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f7f\u7528 CSS mask-composite \u4f18\u96c5\u5730\u89e3\u51b3\u7f3a\u53e3\u95ee\u9898\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u4f7f\u7528 CSS mask-composite \u4f18\u96c5\u5730\u89e3\u51b3\u7f3a\u53e3\u95ee\u9898\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u4f18\u96c5\u89e3\u51b3  \u7f3a\u53e3\u95ee\u9898<\/strong><\/p>\n<p>\u5728\u5236\u4f5c\u7f3a\u53e3\u65f6\uff0c\u4f7f\u7528\u906e\u7f69\uff08mask\uff09\u5b58\u5728\u9700\u8981\u9010\u4e2a\u521b\u5efa\u906e\u7f69\u5c42\u56fe\u7247\u7684\u7e41\u7410\u95ee\u9898\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u4e00\u79cd\u4f18\u96c5\u7684\u89e3\u51b3\u529e\u6cd5\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848\uff1amask-composite<\/strong><\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528 mask \u4e2d\u7684 mask-composite \u6765\u5b9e\u73b0\u6240\u9700\u6548\u679c\u3002<\/p>\n<ol>\n<li> <strong>\u521b\u5efa\u6e10\u53d8\u80cc\u666f\uff1a<\/strong> \u4f7f\u7528\u7ebf\u6027\u6e10\u53d8\u521b\u5efa\u4e00\u4e2a\u7eaf\u8272\u80cc\u666f\u3002<\/li>\n<li> <strong>\u5236\u4f5c\u51f9\u89d2 SVG\uff1a<\/strong> \u4f7f\u7528 SVG \u56fe\u7247\u5236\u4f5c\u7f3a\u53e3\u5f62\u72b6\uff0c\u5e76\u5c06\u5176\u5b9a\u4f4d\u5728\u53f3\u4fa7\u3002<\/li>\n<li> <strong>\u5408\u6210\u906e\u7f69\uff1a<\/strong> \u4f7f\u7528 mask-composite: xor \u9009\u9879\uff0c\u53ea\u663e\u793a\u4e0d\u91cd\u5408\u7684\u90e8\u5206\u3002<\/li>\n<li> <strong>\u5b9a\u4f4d\u548c\u91cd\u590d\uff1a<\/strong> \u4f7f\u7528 mask-position \u548c mask-repeat \u9009\u9879\u5206\u522b\u8c03\u6574\u51f9\u89d2\u4f4d\u7f6e\u548c\u80cc\u666f\u91cd\u590d\u65b9\u5f0f\u3002<\/li>\n<\/ol>\n<p><strong>\u4ee3\u7801\u793a\u4f8b\uff1a<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<pre>-webkit-mask: url('\u51f9\u89d2.svg'), linear-gradient(red,red);\n-webkit-mask-composite: xor;\n-webkit-mask-position: right 30px, 0 0;\n-webkit-mask-repeat: no-repeat, repeat;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6f14\u793a\uff1a<\/strong><\/p>\n<p>\u901a\u8fc7\u81ea\u5b9a\u4e49\u5c5e\u6027\u63a7\u5236\u53f3\u4fa7\u7bad\u5934\u4e0a\u4e0b\u4f4d\u7f6e\uff1a<\/p>\n<p>[\u6f14\u793a\u94fe\u63a5](https:\/\/codepen.io\/xboxyan\/pen\/QWJQLwp)<\/p>\n<p><strong>\u6280\u5de7\u6269\u5c55\uff1a<\/strong><\/p>\n<p>\u4e4b\u524d\u7684\u6587\u7ae0\u300aCSS mask \u5b9e\u73b0\u9f20\u6807\u8ddf\u968f\u9542\u7a7a\u6548\u679c\u300b\u4e2d\u4e5f\u4ecb\u7ecd\u4e86\u76f8\u5173\u7684\u6280\u5de7\uff0c\u53ef\u4f9b\u53c2\u8003\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u4f7f\u7528 CSS mask-composite \u4f18\u96c5\u5730\u89e3\u51b3\u7f3a\u53e3\u95ee\u9898\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f18\u96c5\u89e3\u51b3 \u7f3a\u53e3\u95ee\u9898 \u5728\u5236\u4f5c\u7f3a\u53e3\u65f6\uff0c\u4f7f\u7528\u906e\u7f69\uff08mask\uff09\u5b58\u5728\u9700\u8981\u9010\u4e2a\u521b\u5efa\u906e\u7f69\u5c42\u56fe\u7247\u7684\u7e41\u7410\u95ee\u9898\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u4e00\u79cd\u4f18\u96c5\u7684\u89e3\u51b3\u529e\u6cd5\u3002 \u89e3\u51b3\u65b9\u6848\uff1amask-composite \u53ef\u4ee5\u4f7f\u7528 mask \u4e2d\u7684 mask-composite \u6765\u5b9e\u73b0\u6240\u9700\u6548\u679c\u3002 \u521b\u5efa\u6e10\u53d8\u80cc\u666f\uff1a \u4f7f\u7528\u7ebf\u6027\u6e10\u53d8\u521b\u5efa\u4e00\u4e2a\u7eaf\u8272\u80cc\u666f\u3002 \u5236\u4f5c\u51f9\u89d2 SVG\uff1a \u4f7f\u7528 SVG \u56fe\u7247\u5236\u4f5c\u7f3a\u53e3\u5f62\u72b6\uff0c\u5e76\u5c06\u5176\u5b9a\u4f4d\u5728\u53f3\u4fa7\u3002 \u5408\u6210\u906e\u7f69\uff1a \u4f7f\u7528 mask-composite: xor \u9009\u9879\uff0c\u53ea\u663e\u793a\u4e0d\u91cd\u5408\u7684\u90e8\u5206\u3002 \u5b9a\u4f4d\u548c\u91cd\u590d\uff1a \u4f7f\u7528 mask-position \u548c mask-repeat \u9009\u9879\u5206\u522b\u8c03\u6574\u51f9\u89d2\u4f4d\u7f6e\u548c\u80cc\u666f\u91cd\u590d\u65b9\u5f0f\u3002 \u4ee3\u7801\u793a\u4f8b\uff1a \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b -webkit-mask: url(&#8216;\u51f9\u89d2.svg&#8217;), linear-gradient(red,red); -webkit-mask-composite: xor; -webkit-mask-position: right 30px, 0 0; -webkit-mask-repeat: no-repeat, repeat; \u767b\u5f55\u540e\u590d\u5236 \u6f14\u793a\uff1a \u901a\u8fc7\u81ea\u5b9a\u4e49\u5c5e\u6027\u63a7\u5236\u53f3\u4fa7\u7bad\u5934\u4e0a\u4e0b\u4f4d\u7f6e\uff1a [\u6f14\u793a\u94fe\u63a5](https:\/\/codepen.io\/xboxyan\/pen\/QWJQLwp) \u6280\u5de7\u6269\u5c55\uff1a \u4e4b\u524d\u7684\u6587\u7ae0\u300aCSS mask \u5b9e\u73b0\u9f20\u6807\u8ddf\u968f\u9542\u7a7a\u6548\u679c\u300b\u4e2d\u4e5f\u4ecb\u7ecd\u4e86\u76f8\u5173\u7684\u6280\u5de7\uff0c\u53ef\u4f9b\u53c2\u8003\u3002 \u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u4f7f\u7528 CSS mask-composite \u4f18\u96c5\u5730\u89e3\u51b3\u7f3a\u53e3\u95ee\u9898\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-3325","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/3325","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=3325"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/3325\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=3325"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=3325"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=3325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}