加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
style.css 6.40 KB
一键复制 编辑 原始数据 按行查看 历史
呦呀 提交于 2022-01-13 09:02 . '改良'
* {
margin: 0;
padding: 0;
}
body {
background: #a9c6c9;
animation: myfirst 10s infinite;
}
@keyframes myfirst
{
0% {background: #f3ffd9; left:0px; top:0px;}
25% {background: #cadda0; left:200px; top:0px;}
50% {background: #5e6f4d; left:200px; top:200px;}
75% {background: #cadda0; left:0px; top:200px;}
100% {background: #f3ffd9; left:0px; top:0px;}
}
.box1 {
position: relative;
width: 500px;
height: 500px;
margin: 200px auto;
transform-style: preserve-3d;
animation: move1 10s infinite linear;
}
ul {
list-style: none;
}
/* 内盒子样式 */
.minbox1 {
width: 250px;
height: 250px;
position: absolute;
margin: 125px;
transform-style: preserve-3d;
}
.minbox1 li {
width: 250px;
height: 250px;
position: absolute;
}
.minbox1 li:nth-child(1) {
background: url("./img/01.jpg") no-repeat;
background-size: cover;
transform: translateZ(125px);
transition: transform 1.5s; /* 还原时所需的时间 */
}
.minbox1 li:nth-child(2) {
background: url("./img/02.jpg") no-repeat;
background-size: cover;
transform: rotateY(90deg) translateZ(125px);
transition: transform 1.5s;
}
.minbox1 li:nth-child(3) {
background: url("./img/03.jpg") no-repeat;
background-size: cover;
transform: rotateX(90deg) translateZ(125px);
transition: transform 1.5s;
}
.minbox1 li:nth-child(4) {
background: url("./img/04.jpg") no-repeat;
background-size: cover;
transform: rotateX(180deg) translateZ(125px);
transition: transform 1.5s;
}
.minbox1 li:nth-child(5) {
background: url("./img/05.jpg") no-repeat;
background-size: cover;
transform: rotateY(-90deg) translateZ(125px);
transition: transform 1.5s;
}
.minbox1 li:nth-child(6) {
background: url("./img/06.jpg") no-repeat;
background-size: cover;
transform: rotateX(-90deg) translateZ(125px);
transition: transform 1.5s;
}
/*外盒子样式*/
.minbox2 {
line-height: 500px;
width: 500px;
height: 500px;
position: absolute;
margin: auto;
transform-style: preserve-3d;
}
.minbox2 li {
width: 500px;
height: 500px;
position: absolute;
opacity: 0.5;
}
.minbox2 li:nth-child(1) {
background: url("./img/01.jpg") no-repeat;
background-size: cover;
transform: translateZ(220px);
transition: transform 1.5s;
}
.minbox2 li:nth-child(2) {
background: url("./img/02.jpg") no-repeat;
background-size: cover;
transform: rotateY(90deg) translateZ(220px);
transition: transform 1.5s;
}
.minbox2 li:nth-child(3) {
background: url("./img/03.jpg") no-repeat;
background-size: cover;
transform: rotateX(90deg) translateZ(220px);
transition: transform 1.5s;
}
.minbox2 li:nth-child(4) {
background: url("./img/04.jpg") no-repeat;
background-size: cover;
transform: rotateX(180deg) translateZ(220px);
transition: transform 1.5s;
}
.minbox2 li:nth-child(5) {
background: url("./img/05.jpg") no-repeat;
background-size: cover;
transform: rotateY(-90deg) translateZ(220px);
transition: transform 1.5s;
}
.minbox2 li:nth-child(6) {
background: url("./img/06.jpg") no-repeat;
background-size: cover;
transform: rotateX(-90deg) translateZ(220px);
transition: transform 1.5s;
}
/*鼠标悬停*/
.box1:hover {
animation: move2 8s infinite linear;
}
.box1:hover .minbox1 li:nth-child(1) {
transform: translateZ(200px);
transition: transform 1s;
}
.box1:hover .minbox1 li:nth-child(2) {
transform: rotateY(90deg) translateZ(150px);
transition: transform 1s; /* 打开时所需的时间 */
}
.box1:hover .minbox1 li:nth-child(3) {
transform: rotateX(90deg) translateZ(150px);
transition: transform 1s;
}
.box1:hover .minbox1 li:nth-child(4) {
transform: rotateX(180deg) translateZ(150px);
transition: transform 1s;
}
.box1:hover .minbox1 li:nth-child(5) {
transform: rotateY(-90deg) translateZ(150px);
transition: transform 1s;
}
.box1:hover .minbox1 li:nth-child(6) {
transform: rotateX(-90deg) translateZ(150px);
transition: transform 1s;
}
.box1:hover .minbox2 li:nth-child(1) {
transform: translateZ(600px);
transition: transform 2s;
}
.box1:hover .minbox2 li:nth-child(2) {
transform: rotateY(60deg) translateZ(600px);
transition: transform 2s;
}
.box1:hover .minbox2 li:nth-child(3) {
transform: rotateY(120deg) translateZ(600px);
transition: transform 2s;
}
.box1:hover .minbox2 li:nth-child(4) {
transform: rotateY(180deg) translateZ(600px);
transition: transform 2s;
}
.box1:hover .minbox2 li:nth-child(5) {
transform: rotateY(-120deg) translateZ(600px);
transition: transform 2s;
}
.box1:hover .minbox2 li:nth-child(6) {
transform: rotateY(-60deg) translateZ(600px);
transition: transform 2s;
}
@keyframes move1 {
0% {
transform: rotateX(10deg) rotateY(0deg);
}
100% {
transform: rotateX(370deg) rotateY(360deg);
}
}
@keyframes move2 {
0% {
transform: rotateX(20deg) rotateY(0deg);
}
100% {
transform: rotateX(20deg) rotateY(360deg);
}
}
.box2 {
position: relative;
width: 200px;
height: 200px;
margin: 400px auto;
transform-style: preserve-3d;
animation: move2 10s infinite linear;
}
.minbox3 {
width: 200px;
height: 200px;
position: absolute;
margin: auto;
transform-style: preserve-3d;
}
.minbox3 li {
width: 200px;
height: 200px;
position: absolute;
opacity: 0.8;
}
.minbox3 li:nth-child(1) {
background: url("./img/01.jpg") no-repeat;
background-size: cover;
transform: translateZ(100px);
}
.minbox3 li:nth-child(2) {
background: url("./img/02.jpg") no-repeat;
background-size: cover;
transform: rotateX(180deg) translateZ(120px) rotateX(-180deg);
}
.minbox3 li:nth-child(3) {
background: url("./img/03.jpg") no-repeat;
background-size: cover;
transform: rotateX(90deg) translateZ(120px);
}
.minbox3 li:nth-child(4) {
background: url("./img/04.jpg") no-repeat;
background-size: cover;
transform: rotateX(-90deg) translateZ(120px);
}
.minbox3 li:nth-child(5) {
background: url("./img/05.jpg") no-repeat;
background-size: cover;
transform: rotateY(90deg) translateZ(120px);
}
.minbox3 li:nth-child(6) {
background: url("./img/06.jpg") no-repeat;
background-size: cover;
transform: rotateY(-90deg) translateZ(120px);
}
.title {
line-height: 200px;
text-align: center;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化