Cube grid

Developer
Size
2,943 Kb
Views
8,096

How do I make an cube grid?

Randomly generated grid of 6 colours, cube effect on hover. 3D transforms, CSS and a bit of jQuery.. What is a cube grid? How do you make a cube grid? This script and codes were developed by Andrew Canham on 21 December 2022, Wednesday.

Cube grid Previews

Cube grid - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Cube grid</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="allTheCubes">
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Cube grid - Script Codes CSS Codes

body { background: #8fc2dd;
}
.bg1 div.front { background: #8fd7dd;
}
.bg1 div.bottom { background: #54c2cb;
}
.bg2 div.front { background: #dd8fd2;
}
.bg2 div.bottom { background: #cb54ba;
}
.bg3 div.front { background: #ddb38f;
}
.bg3 div.bottom { background: #cb8b54;
}
.bg4 div.front { background: #918fdd;
}
.bg4 div.bottom { background: #5754cb;
}
.bg5 div.front { background: #8fdd93;
}
.bg5 div.bottom { background: #54cb5a;
}
.bg6 div.front { background: #c6dd8f;
}
.bg6 div.bottom { background: #a8cb54;
}
div.allTheCubes { height: 800px; left: 50%; margin: -400px 0 0 -400px; position: absolute; top: 50%; width: 800px;
}
div.aCube { float: left; height: 80px; -webkit-perspective: 1000px; perspective: 1000px; width: 80px;
}
div.cubeInner { cursor: pointer; height: 100%; position: absolute; -webkit-transform: translateZ(-40px); transform: translateZ(-40px); -webkit-transform-style: preserve-3d; transform-style: preserve-3d; -webkit-transition: all 1s linear; transition: all 1s linear; width: 100%;
}
div.cubeInner:hover { -webkit-transform: translateZ(-40px) rotateX(80deg); transform: translateZ(-40px) rotateX(80deg); -webkit-transition: all .1s linear; transition: all .1s linear;
}
div.front { -webkit-backface-visibility: hidden; backface-visibility: hidden; height: 80px; left: 0; position: absolute; -webkit-transition: all 1s linear; transition: all 1s linear; -webkit-transform: rotateX(0) translateZ(40px); transform: rotateX(0) translateZ(40px); top: 0; width: 80px; z-index: 20;
}
div.bottom { -webkit-backface-visibility: hidden; backface-visibility: hidden; height: 80px; position: absolute; top: 0; width: 80px; z-index: 10; -webkit-transform: rotateX(-90deg) translateZ(40px); transform: rotateX(-90deg) translateZ(40px);
}

Cube grid - Script Codes JS Codes

var backgrounds = [ 'bg1','bg2', 'bg3', 'bg4','bg5', 'bg6'
];
function buildCubes(x) { var y = 0;	function addCube(y, x) { y++; if (y <= x) { $("div.allTheCubes").append("<div class='aCube " + backgrounds[Math.floor(Math.random()*backgrounds.length)] + "'><div class='cubeInner'><div class='front'></div><div class='bottom'></div></div></div>");	addCube(y,x); } } addCube(y,x);
}
buildCubes(100);
Cube grid - Script Codes
Cube grid - Script Codes
Home Page Home
Developer Andrew Canham
Username candroo
Uploaded December 21, 2022
Rating 3
Size 2,943 Kb
Views 8,096
Do you need developer help for Cube grid?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Andrew Canham (candroo) Script Codes
Create amazing love letters with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!