Cube thingy, now fully functional
How do I make an cube thingy, now fully functional?
Rotate cube using arrow keys. What is a cube thingy, now fully functional? How do you make a cube thingy, now fully functional? This script and codes were developed by Teo Dragovic on 05 January 2023, Thursday.
Cube thingy, now fully functional - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Cube thingy, now fully functional</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ * { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
}
html { height: 100%;
}
body { background-image: radial-gradient(#333333, #1a1a1a); overflow: hidden; height: 100%; font-family: sans-serif;
}
.container { position: relative; margin: 100px auto; width: 200px; height: 200px; perspective: 1000px;
}
.cube { position: absolute; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d;
}
.cube .side { position: absolute; display: block; width: 100%; height: 100%; backface-visibility: hidden; box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.2);
}
.cube .side.blue { background-image: radial-gradient(#4a5096, #393e74);
}
.cube .side.pink { background-image: radial-gradient(#944a67, #72394f);
}
.cube .side.aqua { background-image: radial-gradient(#4a8994, #396a72);
}
.cube .side.green { background-image: radial-gradient(#4a944c, #39723b);
}
.cube .side.orange { background-image: radial-gradient(#94764a, #725b39);
}
.cube .side.red { background-image: radial-gradient(#944a4a, #723939);
}
.cube .side.front { transform: rotateX(0deg) translateZ(100px);
}
.cube .side.back { transform: rotateX(180deg) translateZ(100px);
}
.cube .side.right { transform: rotateY(90deg) translateZ(100px);
}
.cube .side.left { transform: rotateY(-90deg) translateZ(100px);
}
.cube .side.top { transform: rotateX(90deg) translateZ(100px);
}
.cube .side.bottom { transform: rotateX(-90deg) translateZ(100px);
}
p { width: 100%; color: #555; text-align: center; line-height: 1.5;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <div class="container"> <div class="cube"> <div class="side blue front"></div> <div class="side pink back"></div> <div class="side aqua right"></div> <div class="side green left"></div> <div class="side orange top"></div> <div class="side red bottom"></div> </div>
</div>
<p>rotate cube using arrow keys<p> <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 thingy, now fully functional - Script Codes CSS Codes
* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
}
html { height: 100%;
}
body { background-image: radial-gradient(#333333, #1a1a1a); overflow: hidden; height: 100%; font-family: sans-serif;
}
.container { position: relative; margin: 100px auto; width: 200px; height: 200px; perspective: 1000px;
}
.cube { position: absolute; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d;
}
.cube .side { position: absolute; display: block; width: 100%; height: 100%; backface-visibility: hidden; box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.2);
}
.cube .side.blue { background-image: radial-gradient(#4a5096, #393e74);
}
.cube .side.pink { background-image: radial-gradient(#944a67, #72394f);
}
.cube .side.aqua { background-image: radial-gradient(#4a8994, #396a72);
}
.cube .side.green { background-image: radial-gradient(#4a944c, #39723b);
}
.cube .side.orange { background-image: radial-gradient(#94764a, #725b39);
}
.cube .side.red { background-image: radial-gradient(#944a4a, #723939);
}
.cube .side.front { transform: rotateX(0deg) translateZ(100px);
}
.cube .side.back { transform: rotateX(180deg) translateZ(100px);
}
.cube .side.right { transform: rotateY(90deg) translateZ(100px);
}
.cube .side.left { transform: rotateY(-90deg) translateZ(100px);
}
.cube .side.top { transform: rotateX(90deg) translateZ(100px);
}
.cube .side.bottom { transform: rotateX(-90deg) translateZ(100px);
}
p { width: 100%; color: #555; text-align: center; line-height: 1.5;
}
Cube thingy, now fully functional - Script Codes JS Codes
var cube = $('.cube'), calc = cube.clone(false);
function applyTransform (transform) { var matrix = calc.css('transform'), composite = transform + ' ' + matrix; calc.css({'transform':composite}).insertAfter(cube); matrix = calc.css('transform'); cube.css({'transform':matrix}); calc.remove();
}
// rotate using arrow keys
$(document).keyup(function(e) { e.preventDefault(); var key = e.which, arrow = {left: 37, up: 38, right: 39, down: 40}, t; switch(key) { case arrow.left: t = 'rotateY(-90deg)'; break; case arrow.right: t = 'rotateY(90deg)'; break; case arrow.up: t = 'rotateX(90deg)'; break; case arrow.down: t = 'rotateX(-90deg)'; break; } applyTransform(t);
});
Developer | Teo Dragovic |
Username | teodragovic |
Uploaded | January 05, 2023 |
Rating | 3 |
Size | 3,833 Kb |
Views | 4,048 |
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 |
A Pen by Teo Dragovic | 2,756 Kb |
Sticky sidebar thingy | 3,068 Kb |
Annoying label thingy | 4,659 Kb |
Page load thingy | 3,146 Kb |
Mobile navigation thingy | 4,294 Kb |
Client logo done in css | 2,273 Kb |
3D letter thingy | 3,589 Kb |
Perfect font size | 2,807 Kb |
Responsive nav with submenus | 4,273 Kb |
Cube thingy | 3,988 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 |
Classy Blockquote Styling | Andrewwright | 3,212 Kb |
Materializecss input form | Jasonchan | 1,443 Kb |
Print element on a page | Mrs_snow | 2,081 Kb |
Virtual vinyl | Davidpanik | 3,474 Kb |
Slim Grid SASS SCSS v3.2 | Thesturs | 4,709 Kb |
Underlined form fields | Mitchdot | 2,323 Kb |
Infractions - Attitude | Kylie_Joseph | 7,672 Kb |
RSW | JordanC | 3,726 Kb |
Testimonial Fancy tabs responsive | Amit-webdesigner | 3,056 Kb |
Project Euler Problem 17 | Bfillmer | 2,739 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!