当前位置: 首页 > news >正文

CSS彩色发光液体玻璃

效果展示

在这里插入图片描述

CSS 知识点

  • animation 综合运用
  • animation-delay 综合运用
  • filter 的 hue-rotate 属性运用

页面整体布局

<section><div class="glass" style="--i: 1"><div class="inner"><div class="liquid"></div></div></div><div class="glass" style="--i: 2"><div class="inner"><div class="liquid"></div></div></div><div class="glass" style="--i: 3"><div class="inner"><div class="liquid"></div></div></div>
</section>

核心样式

编写瓶子样式

.glass {position: relative;
}.glass .inner {position: relative;width: 200px;height: 400px;background: rgba(255, 255, 255, 0.1);border-radius: 40px;border: 8px solid transparent;
}.glass .inner::before {content: "";position: absolute;width: calc(100% - 10px);height: 30px;border: 10px solid #444;border-radius: 50%;top: -15px;left: 50%;transform: translateX(-50%);box-shadow: 0 15px 0 #222;
}.glass .inner::after {content: "";position: absolute;width: 50px;height: 250px;top: 80px;left: 30px;background: rgba(255, 255, 255, 0.1);border-radius: 4px;
}

编写瓶子液体样式

.glass .inner::before {content: "";position: absolute;width: calc(100% - 10px);height: 30px;border: 10px solid #444;border-radius: 50%;top: -15px;left: 50%;transform: translateX(-50%);box-shadow: 0 15px 0 #222;
}.glass .inner::after {content: "";position: absolute;width: 50px;height: 250px;top: 80px;left: 30px;background: rgba(255, 255, 255, 0.1);border-radius: 4px;
}.liquid {position: absolute;top: 50px;left: 5px;right: 5px;bottom: 1px;background: #41c1fb;border-bottom-left-radius: 30px;border-bottom-right-radius: 30px;filter: drop-shadow(0 0 80px #41c1fb);
}.liquid::before {content: "";position: absolute;width: 100%;height: 20px;border-radius: 50%;background: #1fa4e0;top: -10px;
}

编写动画

.glass .inner {animation: animateColor 5s linear infinite;animation-delay: calc(var(--i) * -1.25s);
}@keyframes animateColor {0% {filter: hue-rotate(0deg);}100% {filter: hue-rotate(360deg);}
}.liquid {animation: animateLiquid 5s linear infinite;animation-delay: calc(var(--i) * -1.25s);
}@keyframes animateLiquid {0%,20% {top: 50px;}50%,70% {top: 320px;}100% {top: 50px;}
}

完整代码下载

完整代码下载

http://www.lryc.cn/news/257075.html

相关文章:

  • OpenGLES:glReadPixels()获取相机GLSurfaceView预览数据并保存
  • 小红书蒲公英平台开通后,有哪些注意的地方,以及如何进行报价?
  • 持续集成交付CICD:Jenkins配置Nexus制品上传流水线
  • C语言笔试例题_指针专练30题(附答案解析)
  • 【Vue+Python】—— 基于Vue与Python的图书管理系统
  • 智能成绩表 - 华为OD统一考试(C卷)
  • 【基于ESP32无线蓝牙上传电脑Excel透传数据】
  • Qt篇——QChartView实现鼠标滚轮缩放、鼠标拖拽平移、鼠标双击重置缩放平移、曲线点击显示坐标
  • 掌握VUE中localStorage的使用
  • 所有行业的最终归宿-我有才打造知识付费平台
  • 图的深度和广度优先遍历
  • 计算机毕业设计JAVA+SSM+springboot养老院管理系统
  • Flutter路由的几种用法
  • 力扣119双周赛
  • Redux,react-redux,dva,RTK
  • 基于Java SSM框架实现高校信息资源共享平台系统【项目源码+论文说明】计算机毕业设计
  • SpringMvc入坑系列(一)----maven插件启动tomcat
  • Leetcode—337.打家劫舍III【中等】
  • 列表标签的介绍与使用
  • 浅谈什么是语音芯片的白噪音支持功能:打造舒适家居与优质音频体验
  • 【QED】高昂的猫 Ⅰ
  • Redis如何做内存优化?
  • 倪海厦:教你正确煮中药,发挥最大药效
  • C++学习笔记:继承
  • 音频/视频、信息和通信技术设备安全标准UL62368-1
  • macos下安装科研绘图软件Origin
  • 安全快速地删除 MySQL 大表数据并释放空间
  • 未使用 “严格模式“(js的问题)
  • Verilog基础:$random系统函数的使用
  • 数据库Delete的多种用法