<!DOCTYPE html>
<html lang="en"> <head>
<meta charset="UTF-8">
<title>matrix</title>
</head>
<style>
html,
body {
height: 100%;
margin: 0;
overflow: hidden;
} body {
color: white;
font-family: sans-serif;
font-size: 1.8em;
display: flex;
align-items: center;
justify-content: center;
} .content {
margin: 1px;
width: 140px;
height: 140px;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
transition: all 0.4s cubic-bezier(0.39, 0.575, 0.565, 1);
}
</style> <body> <div class="wowpanel">
<div class="content">move</div>
</div>
<div class="wowpanel">
<div class="content">your</div>
</div>
<div class="wowpanel">
<div class="content">cursor</div>
</div>
<div class="wowpanel">
<div class="content">over</div>
</div> </body> </html>
<script>
let angle = 45;
let wowpanels = document.querySelectorAll(".wowpanel");
let colors = ['#4975FB', '#924DE6', '#EF5252', '#F59500'];
wowpanels.forEach(function(element,i){
maxtridFun(element, colors[i]);
});
function maxtridFun(panel, color) {
let content = panel.querySelector(".content");
content.style.backgroundColor = color;
panel.addEventListener('mouseout',function(e){
content.style.transform = `perspective(300px)
rotateY(0deg)
rotateX(0deg)`;
});
panel.addEventListener('mousemove', function(e){
let w = panel.clientWidth,
h = panel.clientHeight,
y = (e.offsetX - w * 0.5) / w * angle,
x = (1 - (e.offsetY - h * 0.5)) / h * angle;
content.style.transform = `perspective(300px)
rotateX(${x}deg)
rotateY(${y}deg)`;
});
}
</script>

最新文章

  1. DNS域名服务器
  2. [codevs1154][COJ0177][NOIP2006]能量项链
  3. 用Appium进行android自动化测试
  4. 微信小程序注册页面
  5. Yii源码阅读笔记(十四)
  6. 夺命雷公狗---Thinkphp----2之快快速搭建TP环境
  7. ipython, 一个 python 的交互式 shell,比默认的python shell 好用得多,支持变量自动补全,自动缩进,支持 bash shell 命令,内置了许多很有用的功能和函数
  8. Core Bluetooth Programming Guide
  9. Android支付接入(五):机锋网
  10. Oracle 10g创建表空间的完整步骤详解
  11. JAVA并发,线程优先级
  12. 去掉UITableView HeaderView或FooterView随tableView 移动的黏性
  13. git(创建,提交,回退)
  14. Vue-cli 记录
  15. 关于使用lombok遇到的问题
  16. 搭建hadoop伪分布式环境
  17. Quartus prime 16.0 中通过JTAG固化程序
  18. spark操作Kudu之读 - 使用DataFrame API
  19. Nginx配置跨域请求 CORS
  20. [CSL 的字符串][栈,模拟]

热门文章

  1. 金典 SQL笔记(6)
  2. 一个样例看清楚JQuery子元素选择器children()和find()的差别
  3. VIM学习笔记 比较文件(diff)
  4. 关于C语言指针的一些新认识(1)
  5. POJ 1741 Tree 树形DP(分治)
  6. Boost Replaceable by C++11 language features or libraries
  7. oc73--NSArray使用
  8. 为何Google这类巨头会认为敏捷开发原则是废话?
  9. 【POJ 2259】 Team Queue
  10. POJ3090 巧用欧拉函数 phi(x)