Rotating cube
How do I make an rotating cube?
A two faced cube that rotates when it's clicked. What is a rotating cube? How do you make a rotating cube? This script and codes were developed by Hampus Persson on 13 September 2022, Tuesday.
Rotating cube - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Rotating cube</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <section class="container"> <div id="cube"> <figure class="main">Main</figure> <figure class="secondary">Secondary</figure> </div> </section> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Rotating cube - Script Codes CSS Codes
body { font-family: 'Helvetica Neue', Arial, sans-serif; -webkit-text-size-adjust: none; color: #333; background-color: #333;
}
figure { margin: 0;
}
.container { width: 200px; height: 200px; position: relative; margin: 40px auto; -webkit-perspective: 1000px; -moz-perspective: 1000px; -o-perspective: 1000px; perspective: 1000px;
}
#cube { width: 100%; height: 100%; position: absolute; -webkit-transform-style: preserve-3d; -moz-transform-style: preserve-3d; -o-transform-style: preserve-3d; transform-style: preserve-3d; -webkit-transition: -webkit-transform 1s; -moz-transition: -moz-transform 1s; -o-transition: -o-transform 1s; transition: transform 1s;
}
#cube figure { display: block; position: absolute; width: 196px; height: 196px; border: 2px solid black; line-height: 196px; font-size: 30px; font-weight: bold; color: white; text-align: center; -webkit-backface-visibility: hidden; -moz-backface-visibility: hidden; -o-backface-visibility: hidden; backface-visibility: hidden;
}
#cube .main { background: #F3398B; }
#cube .secondary { background: #1D938C ; }
#cube .main { -webkit-transform: translateZ( 100px ); -moz-transform: translateZ( 100px ); -o-transform: translateZ( 100px ); transform: translateZ( 100px );
}
#cube .secondary { -webkit-transform: rotateX( -90deg ) translateZ( 100px ); -moz-transform: rotateX( -90deg ) translateZ( 100px ); -o-transform: rotateX( -90deg ) translateZ( 100px ); transform: rotateX( -90deg ) translateZ( 100px );
}
#cube.show-secondary { -webkit-transform: translateZ( -100px ) rotateX( 90deg ); -moz-transform: translateZ( -100px ) rotateX( 90deg ); -o-transform: translateZ( -100px ) rotateX( 90deg ); transform: translateZ( -100px ) rotateX( 90deg );
}
Rotating cube - Script Codes JS Codes
$('#cube').on('click', function() { $(this).toggleClass('show-secondary');
});
Developer | Hampus Persson |
Username | hmps |
Uploaded | September 13, 2022 |
Rating | 3 |
Size | 2,161 Kb |
Views | 24,288 |
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 |
Filter list | 3,517 Kb |
A Pen by Hampus Persson | 1,560 Kb |
Button style | 2,644 Kb |
Drag and drop editor | 3,422 Kb |
Release CLI | 3,195 Kb |
Slide like Mailbox | 3,758 Kb |
Inputs with floating labels | 3,078 Kb |
Notifications | 4,111 Kb |
The media object | 2,731 Kb |
JSCSS | 3,963 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 |
SCSS Social Icons Flat | Mattsince87 | 3,482 Kb |
Draggable directive | YahyaKacem | 2,277 Kb |
My Interests | Anshusaxenaarora | 2,015 Kb |
Hexagons | Ashmind | 4,360 Kb |
Improve | Gavra | 1,652 Kb |
Halo 5 REQ Guide Bookmarklet | Cwacht | 3,993 Kb |
Minimal Material Design Form Input | Koenigsegg1 | 3,076 Kb |
Angular Route | Arun_v606 | 1,837 Kb |
Horizontal slider on scroll | Alojzije | 2,672 Kb |
V.35 The Monolith Update - Hero Release Notes | Jordan | 12,045 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!