|
@gradient: 135deg, #185198 0, #34ac94 50%, #c63215 100%; |
|
@rxy0:rotateX(-180deg) rotateY(-180deg); |
|
@rxy180:rotateX(180deg) rotateY(180deg); |
|
|
|
@cubesize:15px; |
|
@zaxis: translateZ(@cubesize/2); |
|
@top:rotateY(90deg); |
|
@bottom:rotateY(-90deg); |
|
@back:rotateY(180deg); |
|
@left:rotateX(-90deg); |
|
@right:rotateX(90deg); |
|
/* Due to centering in position 3,3 the z-index must be moved have the size of a cube side */ |
|
|
|
@keyframes spinningH { |
|
from { |
|
-moz-transform: @rxy180; |
|
-ms-transform: @rxy180; |
|
-o-transform: @rxy180; |
|
-webkit-transform: @rxy180; |
|
transform: @rxy180; |
|
} |
|
to { |
|
-moz-transform: @rxy0; |
|
-ms-transform: @rxy0; |
|
-o-transform: @rxy0; |
|
-webkit-transform: @rxy0; |
|
transform: @rxy0; |
|
} |
|
} |
|
|
|
#container { |
|
perspective: 100px; |
|
perspective-origin: 50% 50%; |
|
transform-origin: 50% 50%; |
|
} |
|
|
|
.animate { |
|
animation: spinningH 20s infinite linear; |
|
} |
|
#cube { |
|
position: relative; |
|
margin: 0 auto; |
|
height: @cubesize; |
|
width: @cubesize; |
|
margin-top: 25px; |
|
transition : transform 2s linear; |
|
-webkit-transform-style : preserve-3d; |
|
transform-style : preserve-3d; |
|
} |
|
|
|
#cube-side { |
|
position: absolute; |
|
height: @cubesize; |
|
width: @cubesize; |
|
padding: -2px; |
|
opacity: 0.4; |
|
background-image: linear-gradient(@gradient); |
|
} |
|
|
|
.create-cubes(-2, 2); |
|
.create-cubes(@min, @max) { |
|
.i; .i(@i: @min) when (@i <= @max) { |
|
.j; .i(@i + 1); |
|
} |
|
.j(@j: @min) when (@j <= @max) { |
|
#p@{i}x@{j}:extend(#cube-side) {} |
|
.j(@j + 1); |
|
} |
|
} |
|
|
|
|
|
/* TODO: Hide certain coordinate cubes based on their parents class, i.e. cube-k would need to hide the coordiante 1,2 */ |
|
|
|
.coordinates(-2, 2); |
|
.coordinates(@min, @max) { |
|
.xcoor; .xcoor(@xcoor: @min) when (@xcoor <= @max) { |
|
.ycoor; .xcoor(@xcoor + 1); |
|
} |
|
.ycoor(@ycoor: @min) when (@ycoor <= @max) { |
|
@ytrans:translatey(@cubesize * @ycoor); |
|
@xtrans:translatex(@cubesize * @xcoor); |
|
#p@{xcoor}x@{ycoor} div:nth-child(1) { |
|
transform: @zaxis @ytrans @xtrans; |
|
background-image: linear-gradient(@gradient); |
|
} |
|
#p@{xcoor}x@{ycoor} div:nth-child(2) { |
|
transform: @top @zaxis @ytrans @xtrans; |
|
background-image: linear-gradient(@gradient); |
|
} |
|
#p@{xcoor}x@{ycoor} div:nth-child(3) { |
|
transform: @back @zaxis @ytrans @xtrans; |
|
background-image: linear-gradient(@gradient); |
|
} |
|
#p@{xcoor}x@{ycoor} div:nth-child(4) { |
|
transform: @bottom @zaxis @ytrans @xtrans; |
|
background-image: linear-gradient(@gradient); |
|
} |
|
#p@{xcoor}x@{ycoor} div:nth-child(5) { |
|
transform: @left @zaxis @ytrans @xtrans; |
|
background-image: linear-gradient(@gradient); |
|
} |
|
#p@{xcoor}x@{ycoor} div:nth-child(6) { |
|
transform: @right @zaxis @ytrans @xtrans; |
|
background-image: linear-gradient(@gradient); |
|
} |
|
.ycoor(@ycoor + 1); |
|
} |
|
} |
|
|
|
|
|
|
|
/* Using master ID to determine which child cubes to hide. */ |