Cube grid
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 - 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);
Developer | Andrew Canham |
Username | candroo |
Uploaded | December 21, 2022 |
Rating | 3 |
Size | 2,943 Kb |
Views | 8,096 |
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!
Name | Size |
Footer animation | 4,240 Kb |
Motivational message | 4,007 Kb |
Angled nav reveal | 4,687 Kb |
3D Fold out reveal | 4,535 Kb |
Color hover buttons | 2,840 Kb |
3D cube - hover rotate | 2,980 Kb |
Spread cards | 4,442 Kb |
A Pen by Andrew Canham | 2,789 Kb |
Hover effect | 2,719 Kb |
Cloxperiment | 3,514 Kb |
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!
Name | Username | Size |
Twitch.tv API | Ryzokuken | 2,618 Kb |
Login with flip 3d animation | Mariusbalaj | 3,014 Kb |
Pure CSS Menu | Bronsrobin | 3,321 Kb |
Login with flip 3d animation | Afiq | 3,012 Kb |
Particle Motion trajectories | Sniejadlik | 5,899 Kb |
Ready-to-Go Three-columns Responsive Typography Template with Off-Canvas Navigation | Englishextra | 18,977 Kb |
Simple yet functional | Matheusxaviersi | 2,025 Kb |
Scroll Arrow | Robooneus | 4,437 Kb |
Blog | Rottingroom | 1,430 Kb |
Drifting Clouds | Benedikte | 2,247 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!