css实现立方体3D翻转动画效果代码
代码语言:html
所属分类:动画
代码描述:css实现立方体3D翻转动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}table{border-collapse:collapse;border-spacing:0}
</style>
<style>
* {
box-sizing: border-box;
}
html, body {
height: 100%;
}
body {
overflow: hidden;
background: black;
}
.wrap {
height: 100%;
transform-style: preserve-3d;
perspective: 400px;
width: 1000px;
margin: 0 auto;
}
.box {
transform-style: preserve-3d;
perspective: 5000px;
position: absolute;
width: 50px;
height: 200px;
top: 50%;
margin-top: -100px;
animation: spin 3s infinite alternate;
}
.side, .top, .bottom {
position: absolute;
}
.top, .bottom {
width: 50px;
height: 50px;
}
.top {
transform: translateZ(100px);
}
.bottom {
transform: rotateY(180deg) translateZ(100px);
}
.side:nth-child(3) {
transform: rotateX(90deg) translateZ(50px);
width: 50px;
height: 200px;
}
.side:nth-child(4) {
width: 200px;
height: 50px;
transform: rotateY(90deg) translateZ(-100px);
}
.side:nth-child(5) {
width: 200px;
height: 50px;
transform: rotateY(-90deg) translateZ(50px);
}
.side:nth-child(6) {
width: 50px;
height: 200px;
transform: rotateX(-90deg) translateZ(-100px);
}
.box:nth-child(1) {
left: 0px;
animation-delay: -0.075s;
}
.box:nth-child(1) div {
background: rgba(.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0