We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
继一次的3D魔方之后,这次带你一起玩转性感美女秀,正常套路,请先一堵为快,有兴趣继续,没兴趣也可以看看美女养眼哦🤪!想直接在线预览 👈
看过上次的3D魔方的同学对于本次的分析会有一定的帮助,当然如果大佬您本身就对css3就已经玩的很666了,那么对于下文的分解就请扮演老师的角色吧,小弟如有不足之处,欢迎斧正。
3D魔方
css3
老师
colNode(){ //生成列的节点 for (var i=0;i<this.colLen;i++){ let iDivCol = document.createElement('div'); //列 iDivCol.className = "div-col"; iDivCol.style.width = this.colW+'px'; iDivCol.style.height = this.cubeH+'px'; iDivCol.style.zIndex = (i>this.colLen/2?this.colLen-i:i); this.swiperEle.appendChild(iDivCol); } }
立体魔方
//——[正、上、左、右] for(var i = 0;i<4;i++){ let dividingLine = i<2; let span = document.createElement('span'); span.className = `${dividingLine?'bg-img':'pure-color'} i${i}`; span.style.width = `${dividingLine? this.colW:this.cubeH}px`; span.style.height = this.cubeH+'px'; if(dividingLine){ span.style.backgroundPosition = `-${index*this.colW}px 0`; }; iDivCol.appendChild(span); };
zIndex
/*四个面的样式*/ ...省略N行 .div-col span.i1{ /*top*/ transform-origin:top; transform:translateZ(-360px) rotateX(90deg); } .div-col span.i2{ /*left*/ transform-origin: left; transform: rotateY(90deg); } .div-col span.i3{ /*right*/ transform-origin:left; transform:translateX(25px) rotateY(90deg); }
div-col
transform-origin:50% 50% -180px
setTimeout
requestAnimationFrame
setInterval
...省略N行 swiperAnimate(){ const _requestAnimationFrame_ = window.requestAnimationFrame||window.WebkitRequestAnimationFrame; const iDivCol = this.swiperEle.querySelectorAll(".div-col"); for(var i=0;i<iDivCol.length;i++){ //让动画更逼真,给个过渡,当然也可以调整,requestAnimationFrame每次递增的值, iDivCol[i].style.WebkitTransition=`.8s -webkit-transform ease`; iDivCol[i].style.WebkitTransformOrigin=iDivCol[i].style.transformOrigin = "50% 50% -180px"; this.animateMove(iDivCol[i],i,_requestAnimationFrame_); } } animateMove(Col,index,animationFrame){ let ColNum =0; let spanSurface = Col.querySelectorAll("span"); //即将旋转到的面,展示的图片 spanSurface[1].style.backgroundImage="url(./2.jpg)"; setTimeout(()=>{ //每列进行一个延时,以达到缓冲效果 this.rotate(Col,0,spanSurface,animationFrame); },index*this.delayMilli); } ...省略N行
pageDown(){ if(this.status){ console.log("下翻,不能点击") return ; }; this.status = 1; this.pageNum = this.pageNum>=this.imageList.length ? 1 :++this.pageNum; this.swiperAnimate(); }
preloadingImage(){ this.imageList.map((k,v)=>{ let imgNode = new Image(); imgNode.onerror=err=>{ this.imageList.splice(v,1); } imgNode.src = k; }); }
一个效果实现的方式有很多种,比如我们可以设置6个面,每设置一次,都是展示一张图,这样就不用每次旋转完后又去重置图片、角度等问题,包括requestAnimationFrame动画切换的过渡过程,也应该有更好的方式,新手上路中,欢迎各位大佬指点。以上就是今天为您带来的分享,你GET到了吗?如果觉得不错,记得给个赞哦,想第一时间获得最新分享,欢迎扫码关注我的个人公众号:honeyBadger8,👇!
公众号
作者:苏南 - 首席填坑官 来源:@IT·平头哥联盟 链接:https://blog.csdn.net/weixin_43254766 交流:912594095、公众号:honeyBadger8 本文原创,著作权归作者所有。商业转载请联系@IT·平头哥联盟获得授权,非商业转载请注明原链接及出处。
作者:苏南 - 首席填坑官
来源:@IT·平头哥联盟
链接:https://blog.csdn.net/weixin_43254766
交流:912594095、公众号:honeyBadger8
honeyBadger8
本文原创,著作权归作者所有。商业转载请联系@IT·平头哥联盟获得授权,非商业转载请注明原链接及出处。
@IT·平头哥联盟
The text was updated successfully, but these errors were encountered:
meibin08
No branches or pull requests
前言
继一次的3D魔方之后,这次带你一起玩转性感美女秀,正常套路,请先一堵为快,有兴趣继续,没兴趣也可以看看美女养眼哦🤪!想直接在线预览 👈
回顾:
看过上次的
3D魔方
的同学对于本次的分析会有一定的帮助,当然如果大佬您本身就对css3
就已经玩的很666了,那么对于下文的分解就请扮演老师
的角色吧,小弟如有不足之处,欢迎斧正。解析:
创建列DIV :
立体感的构成 :
立体魔方
,它们都是相互独立的,单列的布局结构 :
zIndex
,需要注意一下,层级的调整,可以覆盖立体透视造成的影响,切换 :
div-col
]来进行旋转即可,transform-origin:50% 50% -180px
,即设置旋转的中心点:setTimeout
,得以达到缓冲的视差,requestAnimationFrame
就该它出场了,setInterval
已经成为过去式,上下翻页 :
预加载 :
总结:
一个效果实现的方式有很多种,比如我们可以设置6个面,每设置一次,都是展示一张图,这样就不用每次旋转完后又去重置图片、角度等问题,包括
requestAnimationFrame
动画切换的过渡过程,也应该有更好的方式,新手上路中,欢迎各位大佬指点。以上就是今天为您带来的分享,你GET到了吗?如果觉得不错,记得给个赞哦,想第一时间获得最新分享,欢迎扫码关注我的个人公众号
:honeyBadger8,👇!The text was updated successfully, but these errors were encountered: