首页 > 编程语言 >3D表白动态相册-包含源码压缩包和方法

3D表白动态相册-包含源码压缩包和方法

时间:2022-11-24 11:01:01浏览次数:57  
标签:translateZ transform li nth 源码 child webkit 压缩包 3D


文章目录

  • ​​1. 先上个例子​​
  • ​​2. HTML页面设计​​
  • ​​3. css风格设计​​
  • ​​4. 12张图片​​
  • ​​5. GitHub仓库自行下载​​
  • ​​6. 结果​​
  • ​​注记​​

1. 先上个例子

3D表白动态相册-包含源码压缩包和方法_css3

2. HTML页面设计

保存为​​index.html​

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>纯CSS实现鼠标经过3D立体动态展示图片特效代码</title>
<link type="text/css" href="css/style.css" rel="stylesheet" />
</head>
<body>
<div class="box">
<ul class="minbox">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<ol class="maxbox">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ol>
</div>
</body>
</html>

3. css风格设计

保存为 ​​css/style.css​

@charset "utf-8";
*{
margin:0;
padding:0;
}
body{
max-width: 100%;
min-width: 100%;
height: 100%;
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
background-size:100% 100%;
position: absolute;
margin-left: auto;
margin-right: auto;
}
li{
list-style: none;
}
.box{
width:200px;
height:200px;
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
background-size:100% 100%;
position: absolute;
margin-left: 42%;
margin-top: 22%;
-webkit-transform-style:preserve-3d;
-webkit-transform:rotateX(13deg);
-webkit-animation:move 5s linear infinite;
}
.minbox{
width:100px;
height:100px;
position: absolute;
left:50px;
top:30px;
-webkit-transform-style:preserve-3d;
}
.minbox li{
width:100px;
height:100px;
position: absolute;
left:0;
top:0;
}
.minbox li:nth-child(1){
background: url(../img/01.png) no-repeat 0 0;
-webkit-transform:translateZ(50px);
}
.minbox li:nth-child(2){
background: url(../img/02.png) no-repeat 0 0;
-webkit-transform:rotateX(180deg) translateZ(50px);
}
.minbox li:nth-child(3){
background: url(../img/03.png) no-repeat 0 0;
-webkit-transform:rotateX(-90deg) translateZ(50px);
}
.minbox li:nth-child(4){
background: url(../img/04.png) no-repeat 0 0;
-webkit-transform:rotateX(90deg) translateZ(50px);
}
.minbox li:nth-child(5){
background: url(../img/05.png) no-repeat 0 0;
-webkit-transform:rotateY(-90deg) translateZ(50px);
}
.minbox li:nth-child(6){
background: url(../img/06.png) no-repeat 0 0;
-webkit-transform:rotateY(90deg) translateZ(50px);
}
.maxbox li:nth-child(1){
background: url(../img/1.png) no-repeat 0 0;
-webkit-transform:translateZ(50px);
}
.maxbox li:nth-child(2){
background: url(../img/2.png) no-repeat 0 0;
-webkit-transform:translateZ(50px);
}
.maxbox li:nth-child(3){
background: url(../img/3.png) no-repeat 0 0;
-webkit-transform:rotateX(-90deg) translateZ(50px);
}
.maxbox li:nth-child(4){
background: url(../img/4.png) no-repeat 0 0;
-webkit-transform:rotateX(90deg) translateZ(50px);
}
.maxbox li:nth-child(5){
background: url(../img/5.png) no-repeat 0 0;
-webkit-transform:rotateY(-90deg) translateZ(50px);
}
.maxbox li:nth-child(6){
background: url(../img/6.png) no-repeat 0 0;
-webkit-transform:rotateY(90deg) translateZ(50px);
}
.maxbox{
width: 800px;
height: 400px;
position: absolute;
left: 0;
top: -20px;
-webkit-transform-style: preserve-3d;

}
.maxbox li{
width: 200px;
height: 200px;
background: #fff;
border:1px solid #ccc;
position: absolute;
left: 0;
top: 0;
opacity: 0.2;
-webkit-transition:all 1s ease;
}
.maxbox li:nth-child(1){
-webkit-transform:translateZ(100px);
}
.maxbox li:nth-child(2){
-webkit-transform:rotateX(180deg) translateZ(100px);
}
.maxbox li:nth-child(3){
-webkit-transform:rotateX(-90deg) translateZ(100px);
}
.maxbox li:nth-child(4){
-webkit-transform:rotateX(90deg) translateZ(100px);
}
.maxbox li:nth-child(5){
-webkit-transform:rotateY(-90deg) translateZ(100px);
}
.maxbox li:nth-child(6){
-webkit-transform:rotateY(90deg) translateZ(100px);
}
.box:hover ol li:nth-child(1){
-webkit-transform:translateZ(300px);
width: 400px;
height: 400px;
opacity: 0.8;
left: -100px;
top: -100px;
}
.box:hover ol li:nth-child(2){
-webkit-transform:rotateX(180deg) translateZ(300px);
width: 400px;
height: 400px;
opacity: 0.8;
left: -100px;
top: -100px;
}
.box:hover ol li:nth-child(3){
-webkit-transform:rotateX(-90deg) translateZ(300px);
width: 400px;
height: 400px;
opacity: 0.8;
left: -100px;
top: -100px;
}
.box:hover ol li:nth-child(4){
-webkit-transform:rotateX(90deg) translateZ(300px);
width: 400px;
height: 400px;
opacity: 0.8;
left: -100px;
top: -100px;
}
.box:hover ol li:nth-child(5){
-webkit-transform:rotateY(-90deg) translateZ(300px);
width: 400px;
height: 400px;
opacity: 0.8;
left: -100px;
top: -100px;
}
.box:hover ol li:nth-child(6){
-webkit-transform:rotateY(90deg) translateZ(300px);
width: 400px;
height: 400px;
opacity: 0.8;
left: -100px;
top: -100px;
}
@keyframes move{
0%{
-webkit-transform: rotateX(13deg) rotateY(0deg);
}
100%{
-webkit-transform:rotateX(13deg) rotateY(360deg);
}
}

4. 12张图片

保存到 ​​img/*​

3D表白动态相册-包含源码压缩包和方法_css_02



其中01-06是100100像素点的正方形png格式图片
其中1-6是400
400像素点的正方形png格式图片

5. GitHub仓库自行下载

​nwu_zjq / Album3D​

6. 结果

通过使用服务器挂载了这个静态页面, 随时可以访问, 在制作成二维码, 向表白的人来一波表白还是有惊喜的

话不多说,

注记

因为10.23是纪念日, 做个小玩意纪念一下, 发现这东西可能作为表白挺合适的, 别的没啥用


标签:translateZ,transform,li,nth,源码,child,webkit,压缩包,3D
From: https://blog.51cto.com/u_15888063/5882671

相关文章

  • 【通知】▁▂▃ Himi 最新著作《iOS游戏编程之从零开始—Cocos2d-x与cocos2d引擎游戏
       2013年新年,Himi的第二本著作:《iOS游戏编程之从零开始—Cocos2d-x与cocos2d引擎游戏开发》一书正式发售;(大家可以到新华书店、淘宝、拍拍、当当、亚马逊等进行购买); ......
  • 【iOS-Cocos2d游戏开发之二】Cocos2D 游戏开发资源贴(教程以及源码)
    ​​ 李华明Himi ​​​原创   这两天抽出一些时间学习cocos2d,发现资料N多,而且讲解的相当的全面;那么这段时间我也处于不断的学习中,当然好东西不私藏,这里我把比较经典......
  • 3d激光雷达开发(多雷达标定)
            有过camera开发经验的朋友都知道,camera有两种标定。一种是内参标定,主要是标定切向畸变、径向畸变等参数;一种是外参标定,主要是把数据从摄像头坐标系转移到全......
  • 3d激光雷达开发(欧几里得聚类算法)
            图形处理里面有一个聚类算法,叫k-means。基本思想就是默认图像里面有k个区域,每个区域都可以内部聚合、外部松散的组合体,找到了这k个区域,就可以实现图像的分......
  • 3d激光雷达开发(ransac的思想)
        前面我们写了平面分割、圆柱分割这两篇文章。细心的同学可能发现,这里面都提到了ransac,那什么是ransac呢?    所谓ransac,全称是randomsampleconsensus,......
  • 3d激光雷达开发(项目练习)
            网上关于pcl的教程很多,大部分都是翻译过来的。但是怎么把pcl这些教程串在一起,做一个简单的项目,这方面的资料不多。今天,正好看到一个范例项目,很有代表性,值得......
  • 3d激光雷达开发(平面分割)
        平面分割是点云数据经常需要处理的一个功能。在很多场景下面,平面数据都是没有用的。这个时候需要考虑的,就是怎么把平面数据从点云当中分割出去。鉴于此,pcl库给......
  • 3d激光雷达开发(圆柱分割)
        和平面分割一样,pcl也支持圆柱分割。使用的方法和平面分割也差不多,都是基于ransac的基本原理。在pcl官方库当中,也给出了参考代码,注意关联的pcd文件,https://pcl.r......
  • 3d激光雷达开发(ndt匹配)
        除了icp匹配之外,ndt匹配也是使用比较多的一种方法。相比较icp而言,ndt匹配花的时间要少一些。此外,ndt匹配还需要输入估计的yaw、pitch、roll、x、y、z,这个可以根......
  • 3d激光雷达开发(icp匹配)
        所谓匹配,其实就是看两个点云数据里面,哪些关键点是一样的。这样就可以把一个点云移动到另外合适的位置,组成一个新的点云。一般来说,单个机器人上面,3d激光扫描到的......