Template:3DCube/style.css
From SNCApedia, the shit nobody cares about encyclopedia
Jump to navigationJump to search
/* Template:3DCube/styles.css
Hardware-accelerated 2D matrix simulation of a 3D cube.
Mathematically rigid orthographic projection (zero skew).
Fully compatible with MediaWiki CSS sanitizers. */
.mw-3dcube-scene {
width: 200px;
height: 200px;
position: relative;
/* Scaling is handled inline by the template */
}
.mw-3dcube {
width: 100%;
height: 100%;
position: relative;
}
.mw-3dcube-face {
position: absolute;
width: 200px;
height: 200px;
top: 0;
left: 0;
transform-origin: 50% 50%;
overflow: hidden;
background-color: transparent;
}
/* Force inner images to perfectly fill the face */
.mw-3dcube-face img {
display: block;
width: 100% !important;
height: 100% !important;
border: none !important;
object-fit: cover;
}
/* Base animations */
.mw-3dcube-front { animation: mw-3dcube-front 8s linear infinite; }
.mw-3dcube-right { animation: mw-3dcube-right 8s linear infinite; }
.mw-3dcube-back { animation: mw-3dcube-back 8s linear infinite; }
.mw-3dcube-left { animation: mw-3dcube-left 8s linear infinite; }
.mw-3dcube-top { animation: mw-3dcube-top 8s linear infinite; z-index: 4; }
.mw-3dcube-bottom { animation: mw-3dcube-bottom 8s linear infinite; z-index: 0; }
/* Optional: pause rotation on hover */
.mw-3dcube-scene:hover .mw-3dcube-face { animation-play-state: paused; }
/* --- Mathematically Corrected 2D Matrix Keyframes --- */
@keyframes mw-3dcube-front {
0% { transform: matrix(1, 0, 0, 0.866025, 0, 50); z-index: 6; }
12.5% { transform: matrix(0.707107, 0.353553, 0, 0.866025, 70.7107, 35.3553); z-index: 5; }
25% { transform: matrix(0, 0.5, 0, 0.866025, 100, 0); z-index: 3; }
37.5% { transform: matrix(-0.707107, 0.353553, 0, 0.866025, 70.7107, -35.3553); z-index: 2; }
50% { transform: matrix(-1, 0, 0, 0.866025, 0, -50); z-index: 1; }
62.5% { transform: matrix(-0.707107, -0.353553, 0, 0.866025, -70.7107, -35.3553); z-index: 2; }
75% { transform: matrix(0, -0.5, 0, 0.866025, -100, 0); z-index: 3; }
87.5% { transform: matrix(0.707107, -0.353553, 0, 0.866025, -70.7107, 35.3553); z-index: 5; }
100% { transform: matrix(1, 0, 0, 0.866025, 0, 50); z-index: 6; }
}
@keyframes mw-3dcube-right {
0% { transform: matrix(0, 0.5, 0, 0.866025, 100, 0); z-index: 3; }
12.5% { transform: matrix(-0.707107, 0.353553, 0, 0.866025, 70.7107, -35.3553); z-index: 2; }
25% { transform: matrix(-1, 0, 0, 0.866025, 0, -50); z-index: 1; }
37.5% { transform: matrix(-0.707107, -0.353553, 0, 0.866025, -70.7107, -35.3553); z-index: 2; }
50% { transform: matrix(0, -0.5, 0, 0.866025, -100, 0); z-index: 3; }
62.5% { transform: matrix(0.707107, -0.353553, 0, 0.866025, -70.7107, 35.3553); z-index: 5; }
75% { transform: matrix(1, 0, 0, 0.866025, 0, 50); z-index: 6; }
87.5% { transform: matrix(0.707107, 0.353553, 0, 0.866025, 70.7107, 35.3553); z-index: 5; }
100% { transform: matrix(0, 0.5, 0, 0.866025, 100, 0); z-index: 3; }
}
@keyframes mw-3dcube-back {
0% { transform: matrix(-1, 0, 0, 0.866025, 0, -50); z-index: 1; }
12.5% { transform: matrix(-0.707107, -0.353553, 0, 0.866025, -70.7107, -35.3553); z-index: 2; }
25% { transform: matrix(0, -0.5, 0, 0.866025, -100, 0); z-index: 3; }
37.5% { transform: matrix(0.707107, -0.353553, 0, 0.866025, -70.7107, 35.3553); z-index: 5; }
50% { transform: matrix(1, 0, 0, 0.866025, 0, 50); z-index: 6; }
62.5% { transform: matrix(0.707107, 0.353553, 0, 0.866025, 70.7107, 35.3553); z-index: 5; }
75% { transform: matrix(0, 0.5, 0, 0.866025, 100, 0); z-index: 3; }
87.5% { transform: matrix(-0.707107, 0.353553, 0, 0.866025, 70.7107, -35.3553); z-index: 2; }
100% { transform: matrix(-1, 0, 0, 0.866025, 0, -50); z-index: 1; }
}
@keyframes mw-3dcube-left {
0% { transform: matrix(0, -0.5, 0, 0.866025, -100, 0); z-index: 3; }
12.5% { transform: matrix(0.707107, -0.353553, 0, 0.866025, -70.7107, 35.3553); z-index: 5; }
25% { transform: matrix(1, 0, 0, 0.866025, 0, 50); z-index: 6; }
37.5% { transform: matrix(0.707107, 0.353553, 0, 0.866025, 70.7107, 35.3553); z-index: 5; }
50% { transform: matrix(0, 0.5, 0, 0.866025, 100, 0); z-index: 3; }
62.5% { transform: matrix(-0.707107, 0.353553, 0, 0.866025, 70.7107, -35.3553); z-index: 2; }
75% { transform: matrix(-1, 0, 0, 0.866025, 0, -50); z-index: 1; }
87.5% { transform: matrix(-0.707107, -0.353553, 0, 0.866025, -70.7107, -35.3553); z-index: 2; }
100% { transform: matrix(0, -0.5, 0, 0.866025, -100, 0); z-index: 3; }
}
@keyframes mw-3dcube-top {
0% { transform: matrix(1, 0, 0, 0.5, 0, -86.6025); }
12.5% { transform: matrix(0.707107, -0.353553, 0.707107, 0.353553, 0, -86.6025); }
25% { transform: matrix(0, -0.5, 1, 0, 0, -86.6025); }
37.5% { transform: matrix(-0.707107, -0.353553, 0.707107, -0.353553, 0, -86.6025); }
50% { transform: matrix(-1, 0, 0, -0.5, 0, -86.6025); }
62.5% { transform: matrix(-0.707107, 0.353553, -0.707107, -0.353553, 0, -86.6025); }
75% { transform: matrix(0, 0.5, -1, 0, 0, -86.6025); }
87.5% { transform: matrix(0.707107, 0.353553, -0.707107, 0.353553, 0, -86.6025); }
100% { transform: matrix(1, 0, 0, 0.5, 0, -86.6025); }
}
@keyframes mw-3dcube-bottom {
0% { transform: matrix(1, 0, 0, -0.5, 0, 86.6025); }
12.5% { transform: matrix(0.707107, -0.353553, -0.707107, -0.353553, 0, 86.6025); }
25% { transform: matrix(0, -0.5, -1, 0, 0, 86.6025); }
37.5% { transform: matrix(-0.707107, -0.353553, -0.707107, 0.353553, 0, 86.6025); }
50% { transform: matrix(-1, 0, 0, 0.5, 0, 86.6025); }
62.5% { transform: matrix(-0.707107, 0.353553, 0.707107, 0.353553, 0, 86.6025); }
75% { transform: matrix(0, 0.5, 1, 0, 0, 86.6025); }
87.5% { transform: matrix(0.707107, 0.353553, 0.707107, -0.353553, 0, 86.6025); }
100% { transform: matrix(1, 0, 0, -0.5, 0, 86.6025); }
}