纯css实现3D鼠标跟随倾斜

老规矩先上图

在这里插入图片描述

为什么今天会想起来整这个呢?这是因为和我朋友吵架,
就是关于这个效果的,就是这个 卡片懸停毛玻璃效果,

我朋友认为纯css也能写,

我则坦言他就是在放狗屁,这种跟随鼠标的3D效果要怎么可能能用纯css写,

然后吵着吵着发现,欸,好像真能用css写哦,我以前还写过这种类似的,就是这个取巧&视觉欺诈——纯css互动小飞机

然后我就来自己扇自己的脸了

原理在小飞机那写了,所以这里就不再赘述了

遵循开源精神,源码如下

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>纯css跟随鼠标倾斜</title><style>@font-face {font-family: 'Fredoka One';font-style: normal;font-weight: 400;font-display: swap;src: url(https://fonts.gstatic.com/s/fredokaone/v14/k3kUo8kEI-tA1RRcTZGmTlHGCac.woff2) format('woff2');unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}*,:after,:before {padding: 0;margin: 0 auto;box-sizing: border-box;}body {background-color: #000;height: 100vh;display: grid;grid-template: repeat(15, 1fr)/repeat(15, 1fr);overflow: hidden}.cell {width: 100%;height: 100%;z-index: 2}.cell:nth-child(15n+1):hover~.content {--positionX: 0}.cell:nth-child(n+1):nth-child(-n+15):hover~.content {--positionY: 0}.cell:nth-child(15n+2):hover~.content {--positionX: 1}.cell:nth-child(n+16):nth-child(-n+30):hover~.content {--positionY: 1}.cell:nth-child(15n+3):hover~.content {--positionX: 2}.cell:nth-child(n+31):nth-child(-n+45):hover~.content {--positionY: 2}.cell:nth-child(15n+4):hover~.content {--positionX: 3}.cell:nth-child(n+46):nth-child(-n+60):hover~.content {--positionY: 3}.cell:nth-child(15n+5):hover~.content {--positionX: 4}.cell:nth-child(n+61):nth-child(-n+75):hover~.content {--positionY: 4}.cell:nth-child(15n+6):hover~.content {--positionX: 5}.cell:nth-child(n+76):nth-child(-n+90):hover~.content {--positionY: 5}.cell:nth-child(15n+7):hover~.content {--positionX: 6}.cell:nth-child(n+91):nth-child(-n+105):hover~.content {--positionY: 6}.cell:nth-child(15n+8):hover~.content {--positionX: 7}.cell:nth-child(n+106):nth-child(-n+120):hover~.content {--positionY: 7}.cell:nth-child(15n+9):hover~.content {--positionX: 8}.cell:nth-child(n+121):nth-child(-n+135):hover~.content {--positionY: 8}.cell:nth-child(15n+10):hover~.content {--positionX: 9}.cell:nth-child(n+136):nth-child(-n+150):hover~.content {--positionY: 9}.cell:nth-child(15n+11):hover~.content {--positionX: 10}.cell:nth-child(n+151):nth-child(-n+165):hover~.content {--positionY: 10}.cell:nth-child(15n+12):hover~.content {--positionX: 11}.cell:nth-child(n+166):nth-child(-n+180):hover~.content {--positionY: 11}.cell:nth-child(15n+13):hover~.content {--positionX: 12}.cell:nth-child(n+181):nth-child(-n+195):hover~.content {--positionY: 12}.cell:nth-child(15n+14):hover~.content {--positionX: 13}.cell:nth-child(n+196):nth-child(-n+210):hover~.content {--positionY: 13}.cell:nth-child(15n+15):hover~.content {--positionX: 14}.cell:nth-child(n+211):nth-child(-n+225):hover~.content {--positionY: 14}.content {--positionX: 7;--positionY: 7;top: 0;right: 0;bottom: 0;left: 0;display: flex;justify-content: center;align-items: center}.content,.css {position: absolute}.css {font-family: Fredoka One, cursive;top: 50%;left: 50%;animation: color 3s linear infinite;text-shadow: 0 0 10px #000a;transition: all .5s}.css:first-child {font-size: 100px;animation-delay: 0s;opacity: .1;transform: translateX(calc(-50% - (var(--positionX) - 7)*21px)) translateY(calc(-50% - (var(--positionY) - 7)*21px)) rotateX(calc(0deg - (var(--positionY) - 7)*5deg)) rotateY(calc((var(--positionX) - 7)*5deg))}.css:nth-child(2) {font-size: 110px;animation-delay: -.3s;opacity: .2;transform: translateX(calc(-50% - (var(--positionX) - 7)*18px)) translateY(calc(-50% - (var(--positionY) - 7)*18px)) rotateX(calc(0deg - (var(--positionY) - 7)*5deg)) rotateY(calc((var(--positionX) - 7)*5deg))}.css:nth-child(3) {font-size: 120px;animation-delay: -.6s;opacity: .3;transform: translateX(calc(-50% - (var(--positionX) - 7)*15px)) translateY(calc(-50% - (var(--positionY) - 7)*15px)) rotateX(calc(0deg - (var(--positionY) - 7)*5deg)) rotateY(calc((var(--positionX) - 7)*5deg))}.css:nth-child(4) {font-size: 130px;animation-delay: -.9s;opacity: .4;transform: translateX(calc(-50% - (var(--positionX) - 7)*12px)) translateY(calc(-50% - (var(--positionY) - 7)*12px)) rotateX(calc(0deg - (var(--positionY) - 7)*5deg)) rotateY(calc((var(--positionX) - 7)*5deg))}.css:nth-child(5) {font-size: 140px;animation-delay: -1.2s;opacity: .5;transform: translateX(calc(-50% - (var(--positionX) - 7)*9px)) translateY(calc(-50% - (var(--positionY) - 7)*9px)) rotateX(calc(0deg - (var(--positionY) - 7)*5deg)) rotateY(calc((var(--positionX) - 7)*5deg))}.css:nth-child(6) {font-size: 150px;animation-delay: -1.5s;opacity: .6;transform: translateX(calc(-50% - (var(--positionX) - 7)*6px)) translateY(calc(-50% - (var(--positionY) - 7)*6px)) rotateX(calc(0deg - (var(--positionY) - 7)*5deg)) rotateY(calc((var(--positionX) - 7)*5deg))}.css:nth-child(7) {font-size: 160px;animation-delay: -1.8s;opacity: .7;transform: translateX(calc(-50% - (var(--positionX) - 7)*3px)) translateY(calc(-50% - (var(--positionY) - 7)*3px)) rotateX(calc(0deg - (var(--positionY) - 7)*5deg)) rotateY(calc((var(--positionX) - 7)*5deg))}.css:nth-child(8) {font-size: 170px;animation-delay: -2.1s;opacity: .8;transform: translateX(calc(-50% - (var(--positionX) - 7)*0px)) translateY(calc(-50% - (var(--positionY) - 7)*0px)) rotateX(calc(0deg - (var(--positionY) - 7)*5deg)) rotateY(calc((var(--positionX) - 7)*5deg))}.css:nth-child(9) {font-size: 180px;animation-delay: -2.4s;opacity: .9;transform: translateX(calc(-50% - (var(--positionX) - 7)*-3px)) translateY(calc(-50% - (var(--positionY) - 7)*-3px)) rotateX(calc(0deg - (var(--positionY) - 7)*5deg)) rotateY(calc((var(--positionX) - 7)*5deg))}.css:nth-child(10) {font-size: 190px;animation-delay: -2.7s;opacity: 1;transform: translateX(calc(-50% - (var(--positionX) - 7)*-6px)) translateY(calc(-50% - (var(--positionY) - 7)*-6px)) rotateX(calc(0deg - (var(--positionY) - 7)*5deg)) rotateY(calc((var(--positionX) - 7)*5deg))}@keyframes color {0% {color: #ef8f8f}10% {color: #efc98f}20% {color: #dcef8f}30% {color: #a3ef8f}40% {color: #8fefb6}50% {color: #8fefef}60% {color: #8fb6ef}70% {color: #a38fef}80% {color: #dc8fef}90% {color: #ef8fc9}to {color: #ef8f8f}}</style>
</head><body><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="cell"></div><div class="content"><div class="css">Qayrup</div><div class="css">Qayrup</div><div class="css">Qayrup</div><div class="css">Qayrup</div><div class="css">Qayrup</div><div class="css">Qayrup</div><div class="css">Qayrup</div><div class="css">Qayrup</div><div class="css">Qayrup</div><div class="css">Qayrup</div></div>
</body></html>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.xdnf.cn/news/149490.html

如若内容造成侵权/违法违规/事实不符,请联系一条长河网进行投诉反馈,一经查实,立即删除!

相关文章

去雨去雪去雾数据集构建

在进行去雨去雪去雾算法的学习过程中&#xff0c;需要构建去雨去雪去雾数据集&#xff0c;本文参考Learning Multiple Adverse Weather Removal via Two-stage Knowledge Learning and Multi-contrastive Regularization: Toward a Unified Model论文中的数据集设定&#xff0c…

面试题 17.24. 最大子矩阵

链接&#xff1a; 面试题 17.24. 最大子矩阵 题解&#xff1a; 这样我们就将二维问题转化为了一维问题&#xff0c;现在另一个问题就是怎么把所有情况都遍历到呢&#xff1f; 我们以第i行为第一行&#xff0c;向下延申&#xff0c;设最后一行为第j行&#xff0c;我们就i在这么…

【AI视野·今日NLP 自然语言处理论文速览 第四十七期】Wed, 4 Oct 2023

AI视野今日CS.NLP 自然语言处理论文速览 Wed, 4 Oct 2023 Totally 73 papers &#x1f449;上期速览✈更多精彩请移步主页 Daily Computation and Language Papers Contrastive Post-training Large Language Models on Data Curriculum Authors Canwen Xu, Corby Rosset, Luc…

手机或者电脑连接局域网内的虚拟机(网桥)

手机或者电脑连接局域网内的虚拟机&#xff08;网桥&#xff09; 手机软件&#xff1a;ConnectBot&#xff0c;Termius&#xff0c;JuiceSSH … 1.虚拟机vmware中添加桥接网卡 这里桥接网卡选择的是自动&#xff0c;是自动生成动态IP&#xff0c;如果不需要动态生成&#xff…

MySQL:数据库的物理备份和恢复-冷备份(3)

介绍 物理备份&#xff1a; 直接复制数据文件进行的备份 优点&#xff1a;不需要其他的工具&#xff0c;直接复制就好&#xff0c;恢复直接复制备份文件即可 缺点&#xff1a;与存储引擎有关&#xff0c;跨平台能力较弱 逻辑备份&#xff1a; 从数据库中导出数据另存而进行的备…

性能测试工具 - LoadRunner

什么是性能测试&#xff1f; 性能测试就是测试人员利用性能测试工具模拟系统在不同情况下的性能指标是否正常。 性能测试工具 - LoadRunner 接下来介绍LoadRunner的作用和使用。 LoadRunner 就是一个很常见的性能测试工具&#xff0c;它有三个部分组成&#xff1a; 这三个组…

【MyBatis-Plus】快速精通Mybatis-plus框架—快速入门

大家在日常开发中应该能发现&#xff0c;单表的CRUD功能代码重复度很高&#xff0c;也没有什么难度。而这部分代码量往往比较大&#xff0c;开发起来比较费时。 因此&#xff0c;目前企业中都会使用一些组件来简化或省略单表的CRUD开发工作。目前在国内使用较多的一个组件就是…

Java实现微信支付

微信支付 小黄最在工作中对接需要对接微信支付&#xff0c;在此记录一下微信支付开发的相关流程&#xff0c;望能帮助到各位 前期准备 由于小黄是小程序端需要对接微信支付&#xff0c;需要注册小程序等&#xff0c;小黄会一一列举出来 小程序注册 所需文件 没有注册过微信…

私有云盘:lamp部署nextcloud+高可用集群

目录 一、实验准备&#xff1a; 二、配置mariadb主从复制 三台主机下载mariadb 1&#xff09;主的操作 2&#xff09;从的操作 3&#xff09;测试数据是否同步 三、配置nfs让web服务挂载 1、安装 2、配置nfs服务器 3、配置web服务的httpd 4、测试 四、web 服务器 配…

排序篇(三)----交换排序

排序篇(三)----交换排序 1.冒泡排序 基本思想: ​ 通过不断地比较相邻的元素&#xff0c;将较大的元素往后移动&#xff0c;从而实现排序的目的。 具体的步骤如下&#xff1a; 从待排序的数组中选择相邻的两个元素进行比较&#xff0c;如果前一个元素大于后一个元素&#…

ParagonNTFSforMac_15.5.102中文版最受欢迎的NTFS硬盘格式读取工具

Paragon NTFS for Mac是一款可以为您轻松解决Mac平台上不能识别Windows通用的NTFS文件难题&#xff0c;这是一款强大的Mac读写工具&#xff0c;相信在很多时候&#xff0c;Mac用户需要对NTFS文件的移动硬盘进行写入&#xff0c;但是macOS系统默认是不让写入的&#xff0c;使用小…

Nginx与Spring Boot的错误模拟实践:探索502和504错误的原因

文章目录 前言502和504区别---都是Nginx返回的access.log和error.log介绍SpringBoot结合Nginx实战502 and 504准备工作Nginx配置host配置SpringBoot 502模拟access.logerror.log 504模拟access.logerror.log 500模拟access.logerror.log 总结 前言 刚工作那会&#xff0c;最常…

Jmeter基础篇

1.性能测试指标 【虚拟用户数】&#xff1a;线程用户 【并发数】&#xff1a;指在某一时间&#xff0c;一定数量的虚拟用户同时对系统的某个功能进行交互&#xff0c;一般通过集合点实现 【事务】:事务代表一个完整的功能&#xff0c;一个接口可以是事务&#xff0c;多个接口…

第八章 排序 三、希尔排序

目录 一、算法思想 二、例子 三、代码实现 五、验证 六、空间复杂度 七、时间复杂度 八、稳定性 一、算法思想 先追求表中元素部分有序&#xff0c;在逐渐逼近表中元素全部有序。 二、例子 1、我们要升序排列此表 2、取一个差值作为子表的划分的条件&#xff0c;希尔本…

医疗器械标准目录汇编2022版共178页(文中附下载链接!)

为便于更好地应用医疗器械标准&#xff0c;国家药监局医疗器械标准管理中心组织对现行1851项医疗器械国家和行业标准按技术领域&#xff0c;编排形成《医疗器械标准目录汇编&#xff08;2022版&#xff09;》 该目录汇编分为通用技术领域和专业技术领域两大类&#xff0c;通用…

【逐步剖C】-第十一章-动态内存管理

一、为什么要有动态内存管理 从我们平常的学习经历来看&#xff0c;所开辟的数组一般都为固定长度大小的数组&#xff1b;但从很多现实需求来看需要我们开辟一个长度“可变”的数组&#xff0c;即这个数组的大小不能在建立数组时就指定&#xff0c;需要根据某个变量作为标准。…

分词.join 保存txt

要求 分词.join 保存txt 第1种方法 分词.join 保存txt input多行文本 /storage/emulated/0/数据中心/txt没有就新建为什么会想到这么做 1. 是因为有分词文件&#x1f4c4;要处理 2. 对各种词语和线索进行分类 3. 解释一下生活中不常见的现象&#xff0c;但是深刻的符合社会…

Inno Setup新手使用教程

1.编写脚本.iss文件 2.使用Inno Setup打开脚本 3.点击运行 4.打包好的文件在output文件夹下 注&#xff1a;运行不通过可能是文件不存在或者路径错误 推荐一个零声学院项目课&#xff0c;个人觉得老师讲得不错&#xff0c;分享给大家&#xff1a; 零声白金学习卡&#xff08;含…

PsychoPy Coder 心理学实验 斯特鲁普效应

选题&#xff1a;斯特鲁普效应实验 选题来源&#xff1a;你知道的「有趣的心理学实验」有哪些&#xff1f; - 知乎 (zhihu.com) 测试目标&#xff1a;探索斯特鲁普效应&#xff0c;即被试在判断文字颜色时&#xff0c;当文字的颜色与其所表示的颜色名称不一致时&#xff0c;是…

博途1200/1500 ALT指令

SMART PLC的ALT指令实现代码,请查看下面文章博客 SMART PLC如何构造ALT指令_smart200类似alt指令-CSDN博客单按钮启停这些老生常谈的问题,很多人感兴趣。这篇博文讨论下不同的实现方法,希望对大家有所帮助。指令虽然简单,但是在编程的时候合理使用对我们高效率编程帮助还是…