脚本宝典收集整理的这篇文章主要介绍了纯 CSS 实现蜡烛融化(水滴)的示例代码,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
实现效果
实现思路
融化效果是利用 filfilter 的 contrast 和 blur 实现的。
在父元素中设置 contrast 并在子元素中设置 blur 即可实现两者相融的效果。
代码
<!DOCTYPE htML> <html lang="en"> <head> <meta charset="UTF-8"> <tITle>水滴效果</title> <link rel="stylesheet" type="text/css" href="css/index.css"> </head> <body> <div class="hpc">下雨收衫</div> </body> </html>
html,body{ margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: #000; filter: contrast(20); } .both{ left: 0; content: ""; width: 10px; height: 20px; bottom: -20px; border-radius: 50%; position: absolute; background-color: #fff; } .hpc{ top: 80px; left: 100px; color: #fff; width: 400px; height: 107px; font-Size: 6rem; filter: blur(3px); font-style: italic; position: relative; transform: skewY(5deg); font-family: "Comic Sans MS"; border-bottom: 10px solid #fff; &::before{ @extend .both; animation: move 6s ease-in-out infinite; } &::after{ @extend .both; animation: move 6s 1s ease-in-out infinite; } @keyframes move{ 70%{ bottom: -20px; transform: translate(380px, 5px); } 80%{ transform: translate(380px, 3px); opacity: 1; } 100%{ transform: translate(380px, 180px); opacity: 0; } } }
将 SCSS 转化为 CSS 再导入即可。
到此这篇关于纯 CSS 实现蜡烛融化(水滴)的示例代码的文章就介绍到这了,更多相关 CSS 蜡烛融化内容请搜索脚本宝典以前的文章或继续浏览下面的相关文章,希望大家以后多多支持脚本宝典!
以上是脚本宝典为你收集整理的纯 CSS 实现蜡烛融化(水滴)的示例代码全部内容,希望文章能够帮你解决纯 CSS 实现蜡烛融化(水滴)的示例代码所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。