<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>CSS3 3D骰子多角度翻转特效 - 更多源码WW.96flw.COM</title>
<style>
body {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
background-color: #ececec;
margin: 0;
}
.center {
position: absolute;
left: 50%;
top: 50%;
margin-left: -180px;
margin-top: -230px;
}
.grid {
position: relative;
display: grid;
grid-template-columns: 100px 100px 100px;
grid-template-rows: 280px 100px 20px;
grid-column-gap: 20px;
grid-row-gap: 30px;
border-radius: 10px;
}
.grid .dice {
grid-row: 1;
grid-column: 1 / -1;
}
.grid .y-radio,
.grid .y-degree,
.grid .y-arrow {
grid-row: 2;
grid-column: 1;
}
.grid .z-radio,
.grid .z-degree,
.grid .z-arrow {
grid-row: 2;
grid-column: 2;
}
.grid .x-radio,
.grid .x-degree,
.grid .x-arrow {
grid-row: 2;
grid-column: 3;
}
.grid .radio {
margin: 0;
width: 100%;
height: 100%;
opacity: 0;
z-index: 5;
cursor: pointer;
}
.grid .degree {
border-radius: 10px;
color: #6f9ceb;
font-weight: 900;
font-size: 1.5em;
width: 100%;
height: 100%;
z-index: 3;
box-sizing: border-box;
align-items: center;
justify-content: center;
}
.grid .label {
text-align: center;
grid-column: 1 / -1;
}
.degree,
.radio {
display: none;
}
.y-radio[value="1"],
.y-radio[value="1"]:checked ~ .y-radio[value="2"],
.y-radio[value="2"]:checked ~ .y-radio[value="3"],
.y-radio[value="3"]:checked ~ .y-radio[value="4"] {
display: block;
}
.z-radio[value="1"],
.z-radio[value="1"]:checked ~ .z-radio[value="2"],
.z-radio[value="2"]:checked ~ .z-radio[value="3"],
.z-radio[value="3"]:checked ~ .z-radio[value="4"] {
display: block;
}
.x-radio[value="1"],
.x-radio[value="1"]:checked ~ .x-radio[value="2"],
.x-radio[value="2"]:checked ~ .x-radio[value="3"],
.x-radio[value="3"]:checked ~ .x-radio[value="4"] {
display: block;
}
.y-radio[value="1"]:checked ~ .y-radio:hover ~ #y1,
.y-radio:hover ~ .y-radio[value="1"]:checked ~ #y1 {
display: flex;
}
.y-radio[value="2"]:checked ~ .y-radio:hover ~ #y2,
.y-radio:hover ~ .y-radio[value="2"]:checked ~ #y2 {
display: flex;
}
.y-radio[value="3"]:checked ~ .y-radio:hover ~ #y3,
.y-radio:hover ~ .y-radio[value="3"]:checked ~ #y3 {
display: flex;
}
.y-radio[value="4"]:checked ~ .y-radio:hover ~ #y4,
.y-radio:hover ~ .y-radio[value="4"]:checked ~ #y4 {
display: flex;
}
.z-radio[value="1"]:checked ~ .z-radio:hover ~ #z1,
.z-radio:hover ~ .z-radio[value="1"]:checked ~ #z1 {
display: flex;
}
.z-radio[value="2"]:checked ~ .z-radio:hover ~ #z2,
.z-radio:hover ~ .z-radio[value="2"]:checked ~ #z2 {
display: flex;
}
.z-radio[value="3"]:checked ~ .z-radio:hover ~ #z3,
.z-radio:hover ~ .z-radio[value="3"]:checked ~ #z3 {
display: flex;
}
.z-radio[value="4"]:checked ~ .z-radio:hover ~ #z4,
.z-radio:hover ~ .z-radio[value="4"]:checked ~ #z4 {
display: flex;
}
.x-radio[value="1"]:checked ~ .x-radio:hover ~ #x1,
.x-radio:hover ~ .x-radio[value="1"]:checked ~ #x1 {
display: flex;
}
.x-radio[value="2"]:checked ~ .x-radio:hover ~ #x2,
.x-radio:hover ~ .x-radio[value="2"]:checked ~ #x2 {
display: flex;
}
.x-radio[value="3"]:checked ~ .x-radio:hover ~ #x3,
.x-radio:hover ~ .x-radio[value="3"]:checked ~ #x3 {
display: flex;
}
.x-radio[value="4"]:checked ~ .x-radio:hover ~ #x4,
.x-radio:hover ~ .x-radio[value="4"]:checked ~ #x4 {
display: flex;
}
.dice {
display: flex;
justify-content: center;
align-items: center;
transform-origin: center center;
transform-style: preserve-3d;
transition: transform 1s;
}
.dice .box {
transform-style: preserve-3d;
width: 150px;
height: 150px;
position: relative;
}
.dice .box svg {
background-color: white;
border: 2px solid #0059b3;
fill: #003366;
position: absolute;
border-radius: 10px;
width: 150px;
height: 150px;
}
.dice .box .front {
transform: translateX(-75px) translateZ(75px);
}
.dice .box .back {
transform: translateX(-75px) rotateX(180deg) translateZ(75px);
}
.dice .box .right {
transform: translateX(-75px) rotateY(90deg) translateZ(75px);
}
.dice .box .left {
transform: translateX(-75px) rotateY(-90deg) translateZ(75px);
}
.dice .box .top {
transform: translateX(-75px) rotateX(90deg) translateZ(75px);
}
.dice .box .bottom {
transform: translateX(-75px) rotateX(-90deg) translateZ(75px);
}
.arrow {
position: relative;
transform-origin: center center;
transform-style: preserve-3d;
transition: transform 1s;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
width: 100%;
}
.arrow .head {
position: absolute;
transform: translateZ(40px);
width: 0;
height: 0;
border-left: 25px solid transparent;
border-right: 25px solid transparent;
border-bottom: 25px solid #004d99;
}
.arrow .tail-part {
position: absolute;
width: 30px;
height: 8px;
}
.arrow .tail-part:nth-of-type(2) {
transform: rotateX(-20deg) translateZ(40px);
background-color: #0052a3;
}
.arrow .tail-part:nth-of-type(3) {
transform: rotateX(-30deg) translateZ(40px);
background-color: #0054a8;
}
.arrow .tail-part:nth-of-type(4) {
transform: rotateX(-40deg) translateZ(40px);
background-color: #0057ad;
}
.arrow .tail-part:nth-of-type(5) {
transform: rotateX(-50deg) translateZ(40px);
background-color: #0059b3;
}
.arrow .tail-part:nth-of-type(6) {
transform: rotateX(-60deg) translateZ(40px);
background-color: #005cb8;
}
.arrow .tail-part:nth-of-type(7) {
transform: rotateX(-70deg) translateZ(40px);
background-color: #005ebd;
}
.arrow .tail-part:nth-of-type(8) {
transform: rotateX(-80deg) translateZ(40px);
background-color: #0061c2;
}
.arrow .tail-part:nth-of-type(9) {
transform: rotateX(-90deg) translateZ(40px);
background-color: #0063c7;
}
.arrow .tail-part:nth-of-type(10) {
transform: rotateX(-100deg) translateZ(40px);
background-color: #0066cc;
}
.arrow .tail-part:nth-of-type(11) {
transform: rotateX(-110deg) translateZ(40px);
background-color: #0069d1;
}
.arrow .tail-part:nth-of-type(12) {
transform: rotateX(-120deg) translateZ(40px);
background-color: #006bd6;
}
.arrow .tail-part:nth-of-type(13) {
transform: rotateX(-130deg) translateZ(40px);
background-color: #006edb;
}
.arrow .tail-part:nth-of-type(14) {
transform: rotateX(-140deg) translateZ(40px);
background-color: #0070e0;
}
.arrow .tail-part:nth-of-type(15) {
transform: rotateX(-150deg) translateZ(40px);
background-color: #0073e6;
}
.arrow .tail-part:nth-of-type(16) {
transform: rotateX(-160deg) translateZ(40px);
background-color: #0075eb;
}
.arrow .tail-part:nth-of-type(17) {
transform: rotateX(-170deg) translateZ(40px);
background-color: #0078f0;
}
.arrow .tail-part:nth-of-type(18) {
transform: rotateX(-180deg) translateZ(40px);
background-color: #007af5;
}
.arrow .tail-part:nth-of-type(19) {
transform: rotateX(-190deg) translateZ(40px);
background-color: #007dfa;
}
.arrow .tail-part:nth-of-type(20) {
transform: rotateX(-200deg) translateZ(40px);
background-color: #0080ff;
}
.arrow .tail-part:nth-of-type(21) {
transform: rotateX(-210deg) translateZ(40px);
background-color: #0582ff;
}
.arrow .tail-part:nth-of-type(22) {
transform: rotateX(-220deg) translateZ(40px);
background-color: #0a85ff;
}
.arrow .tail-part:nth-of-type(23) {
transform: rotateX(-230deg) translateZ(40px);
background-color: #0f87ff;
}
.arrow .tail-part:nth-of-type(24) {
transform: rotateX(-240deg) translateZ(40px);
background-color: #148aff;
}
.arrow .tail-part:nth-of-type(25) {
transform: rotateX(-250deg) translateZ(40px);
bac