吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2520|回复: 22
收起左侧

[其他转载] 3D旋转效果,网站的动态面板

[复制链接]
rundreamer 发表于 2022-5-21 10:03
说明一下:
1.此功能是本人大学时期,跟着网络教程学习时,编写程序
2.网络上有免费类似的东西,github、百度云盘等等都有,但不是每个人都找能找到吧,有的人github网络还有问题呢
3.自己有这方面的资源忽略就好了
4.我也就想弄点积分,就这点想法,不想给的就不给
[HTML] 纯文本查看 复制代码
<!doctype html><html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus&#174;">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>3D旋转</title>
  <style id="css">
	html,body,div,ol,ul,li,input,span{margin:0;padding:0;}
	.banner{
		position:relative;
		width:800px;
		height:360px;
		margin:50px auto;
		/* background:#ff3; */
		perspective:1000px;
	}
	.banner .pic{
		width:800px;
		height:360px;
	}
	.pic ul li{
		position:relative;
		list-style:none;
		/* width:200px; 干掉*/
		height:360px;
		float:left;
		transform-style:preserve-3d;/*景深*/
		transition:2s;/*过渡时间*/
		/* border:1px solid #0f0; */
		transform:translateZ(-180px);/*整个立方体向里面推*/
	}
	.pic ul li span{
		position:absolute;
		display:block;
		/* width:200px; 干掉*/
		height:360px;
		/* border:1px solid red; */
	}
	/* 定位置 */
	.pic ul li span:nth-child(1){
		top:-360px;
		transform-origin:bottom;/*基准*/
		transform:translateZ(180px) rotateX(90deg);
		background-image:url("images/1.jpg");
	}/*上*/
	.pic ul li span:nth-child(2){
		top:360px;
		transform-origin:top;/*基准*/
		transform:translateZ(180px) rotateX(-90deg);
		background-image:url("images/2.jpg");
	}/*下*/
	.pic ul li span:nth-child(3){
		transform:translateZ(180px);
		background-image:url("images/3.jpg");
	}/*前*/
	.pic ul li span:nth-child(4){
		transform:translateZ(-180px) rotateX(180deg);/*平移*/
		background-image:url("images/4.jpg");
	}/*后*/

	/* 定位图片位置 */
	/* .pic li:nth-child(1) span{
		background-position:0px;
	}
	.pic li:nth-child(2) span{
		background-position:-200px;
	}
	.pic li:nth-child(3) span{
		background-position:-400px;
	}
	.pic li:nth-child(4) span{
		background-position:-600px;	
	} */
	/* 规定旋转时间 第二个参数为延迟时间 */
	/* .pic li:nth-child(1){transition:1s 0s;}
	.pic li:nth-child(2){transition:1s 0.2s;}
	.pic li:nth-child(3){transition:1s 0.4s;}
	.pic li:nth-child(4){transition:1s 0.6s;} */
	/* 测试 */
	/* .pic:hover li{
		transform-origin:top;查看效果
		transform:translateZ(-180px) rotateX(180deg);
	} */
	/* 按钮 大盒子定位*/
	.button{
		position:absolute;
		width:100px;
		height:20px;
		bottom:3px;
		right:5px;
		/* border:1px solid red; */
	}
	.button ul li{
		list-style:none;
		float:left;
		width:20px;
		height:20px;
		color:#fff;
		text-align:center;
		line-height:20px;
		background:#000;
		border-radius:10px;
		margin:0 2px;
		box-shadow:1px 1px 5px #fff;
		cursor:pointer;
	}
  </style>
 </head>
 <body>
  <div class="banner">
	<div class="pic">
		<ul></ul>
	</div>
	<div class="button">
		<ul>
			<li>1</li>
			<li>2</li>
			<li>3</li>
			<li>4</li>
		</ul>
	</div>
  </div>
 </body>
 <script src="js/jquery-1.11.1.min.js"></script>
 <script>
	function li(x){
		let lHtml='';	
		let wHtml=800/x;
		let pHtml='';
		let tHtml='';
		let z=0;
		let zHtml='';
		//循环添加li,
		for(let i=0;i<x;i++){
			if(i>x/2){
				z--;
				zHtml+=".pic li:nth-child("+(i+1)+"){z-index:"+z+"}";
			}

			lHtml+="<li><span></span><span></span><span></span><span></span></li>";
			pHtml+=".pic li:nth-child("+(i+1)+") span{background-position:"+(-wHtml*i+'px')+";}";
			tHtml+=".pic li:nth-child("+(i+1)+"){transition:1s "+0.5/x*i+"s;}";
			//0.5*x总时间,分i,与个数挂钩
		}
		$(".pic ul").append(lHtml);//添加x个块
		$("#css").append(pHtml);//移动多少拼接图片
		$("#css").append(tHtml);//延迟时间
		$("#css").append(zHtml);//z-index
		$(".pic ul li,.pic ul li span").css("width",wHtml+"px");//改变宽度
		
		
	}
	$(".button li").click(function(){
		let index=$(this).index();
		let deg=index*90+'deg';
		$(".pic li").css("transform","translateZ(-180px) rotateX("+deg+")")
	})

	li(50);
 </script>
</html>

20220521_095829_20220521100012.gif

3D旋转.zip

337.59 KB, 下载次数: 91, 下载积分: 吾爱币 -1 CB

免费评分

参与人数 12吾爱币 +18 热心值 +12 收起 理由
苏紫方璇 + 7 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
wanshiz + 1 + 1 热心回复!
wang1688 + 1 + 1 用心讨论,共获提升!
椿鬼酉溪 + 1 + 1 热心回复!
GaJnk + 1 + 1 热心回复!
zsw123369 + 1 + 1 我很赞同!
fu520 + 1 + 1 热心回复!
李杨 + 1 + 1 热心回复!
W-A-A-F + 1 + 1 谢谢@Thanks!
不知道改成啥 + 1 + 1 热心回复!
li234002 + 1 + 1 我很赞同!
1lifedo1thing + 1 + 1 用心讨论,共获提升!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

lizooo 发表于 2022-5-21 10:18
这个效果真牛,下载一份跟着学习
orb001 发表于 2022-5-21 10:20
cn449712926 发表于 2022-5-21 10:22
zorro7434 发表于 2022-5-21 10:28
谢谢分享,下载学习
扬灵逸影 发表于 2022-5-21 10:36
一直觉得代码很神奇
C哥888 发表于 2022-5-21 10:50
感谢分享,支持一下
icq168 发表于 2022-5-21 11:59
这个不错,学习了,谢谢分享~
HPgold 发表于 2022-5-21 12:01
感谢分享!学习学习!
deepgo 发表于 2022-5-21 12:08
谢谢分享,下载学习
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-4-30 03:27

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表