Pure CSS Spinning Cube

Developer
Size
2,539 Kb
Views
44,528

How do I make an pure css spinning cube?

Just having fun with pure css animations and cubes, thought this turned out quite cool. What is a pure css spinning cube? How do you make a pure css spinning cube? This script and codes were developed by Izzy Skye on 27 October 2022, Thursday.

Pure CSS Spinning Cube Previews

Pure CSS Spinning Cube - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Pure CSS Spinning Cube</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h2 class="text">Click on the cube! </br><small>(NOTE: Not functioning fully on ie)</small></h2>
<div class="cube-overlord"> <input type="checkbox" id="cube-overlord-check" class="display" /> <label for="cube-overlord-check" class="cube-master"> <div class="cube"> <div class="side"></div> <div class="side"></div> <div class="side"></div> <div class="side"></div> <div class="side"></div> <div class="side"></div> </div> <div class="text-2"></br>Click me again!</div> </label>
</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>

Pure CSS Spinning Cube - Script Codes CSS Codes

* {	box-sizing: border-box;	transition: all 2.2s;	-webkit-transition: all 2.2s;	color: #EEE;	font-family: Monaco, MonoSpace;
}
body {	margin: 0;	background-color: #1d1f20;
}
/* GENERAL STYLES */
.text {	text-align: center;	font-size: 40px;
}
small {	font-size: 16px;
}
.text-2 {	text-align: center;	opacity: 0;
}
.cube-overlord {	position: relative;	margin: 200px auto;	width: 100px;
}
.cube-overlord .display {	display: none;
}
.cube-overlord .cube-master {	position: relative;	width: 120px;	height: 120px;	overflow: hidden;
}
/* CUBESSSSSSSSS */
.cube-overlord .cube {	cursor: pointer;	position: absolute;	width: 100px;	height: 100px;	transform: rotateY(60deg) rotateX(15deg) rotateZ(30deg);	-webkit-transform: rotateY(60deg) rotateX(15deg) rotateZ(30deg);	transform-style: preserve-3d;	-webkit-transform-style: preserve-3d;
}
.cube-overlord .cube .side {	position: absolute;	width: 100px;	height: 100px;	border: 2px solid #E0346A;	box-shadow: 0 0 15px rgba(255, 255, 255, 0.6) inset, 0 0 15px #000;
}
.cube-overlord .cube .side:nth-child(1) {	transform: translateZ(50px);	-webkit-transform: translateZ(50px);
}
.cube-overlord .cube .side:nth-child(2) {	transform: rotateY(90deg) translateZ(50px);	-webkit-transform: rotateY(90deg) translateZ(50px);
}
.cube-overlord .cube .side:nth-child(3) {	transform: rotateY(180deg) translateZ(50px);	-webkit-transform: rotateY(180deg) translateZ(50px);
}
.cube-overlord .cube .side:nth-child(4) {	transform: rotateY(270deg) translateZ(50px);	-webkit-transform: rotateY(270deg) translateZ(50px);
}
.cube-overlord .cube .side:nth-child(5) {	transform: rotateX(90deg) translateZ(50px);	-webkit-transform: rotateX(90deg) translateZ(50px);
}
.cube-overlord .cube .side:nth-child(6) {	transform: rotateX(270deg) translateZ(50px);	-webkit-transform: rotateX(270deg) translateZ(50px);
}
/* ANIMATIONS */
.cube-overlord #cube-overlord-check:checked ~ .cube-master > .text-2 {	opacity: 1;
}
.cube-overlord #cube-overlord-check:not(:checked) ~ .cube-master > .text-2 {	transition: all 0.45s;	-webkit-transition: all 0.45s;
}
.cube-overlord #cube-overlord-check:checked ~ .cube-master > .cube {	transform: rotateY(232deg) rotateX(332deg) rotateZ(250deg);
}
.cube-overlord #cube-overlord-check:checked ~ .cube-master > .cube > .side {	width: 140px;	height: 140px;	border-width: 5px;	box-shadow: 0 0 25px rgba(255, 255, 255, 0.9) inset, 0 0 100px #000;
}
.cube-overlord #cube-overlord-check:checked ~ .cube-master > .cube > .side:nth-child(1) {	transform: translateZ(100px);	-webkit-transform: translateZ(100px);
}
.cube-overlord #cube-overlord-check:checked ~ .cube-master > .cube > .side:nth-child(2) {	transform: rotateY(90deg) translateZ(100px);	-webkit-transform: rotateY(90deg) translateZ(100px);
}
.cube-overlord #cube-overlord-check:checked ~ .cube-master > .cube > .side:nth-child(3) {	transform: rotateY(180deg) translateZ(100px);	-webkit-transform: rotateY(180deg) translateZ(100px);
}
.cube-overlord #cube-overlord-check:checked ~ .cube-master > .cube > .side:nth-child(4) {	transform: rotateY(270deg) translateZ(100px);	-webkit-transform: rotateY(270deg) translateZ(100px);
}
.cube-overlord #cube-overlord-check:checked ~ .cube-master > .cube > .side:nth-child(5) {	transform: rotateX(90deg) translateZ(100px);	-webkit-transform: rotateX(90deg) translateZ(100px);
}
.cube-overlord #cube-overlord-check:checked ~ .cube-master > .cube > .side:nth-child(6) {	transform: rotateX(270deg) translateZ(100px);	-webkit-transform: rotateX(270deg) translateZ(100px);
}

Pure CSS Spinning Cube - Script Codes JS Codes

/**
* Inspired by elneco's cube and put into pure css and html
*
* https://codepen.io/elneco/pen/fnqrv
*
*/
Pure CSS Spinning Cube - Script Codes
Pure CSS Spinning Cube - Script Codes
Home Page Home
Developer Izzy Skye
Username zephyr
Uploaded October 27, 2022
Rating 3
Size 2,539 Kb
Views 44,528
Do you need developer help for Pure CSS Spinning Cube?

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!

Izzy Skye (zephyr) Script Codes
Create amazing marketing copy 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!