HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body> tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html> tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body> tags in a basic HTML5 template. If you need things in the <head> of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit- or -moz-.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
If the stylesheet you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
audio.audio: source(src="https://rawcdn.githack.com/ricardoolivaalonso/Codepen/2afdb800797c6cd1fbfaf24ceba161cefc795eef/Alesis/audio/q.mp3",type="audio/mpeg")
audio.audio: source(src="https://rawcdn.githack.com/ricardoolivaalonso/Codepen/2afdb800797c6cd1fbfaf24ceba161cefc795eef/Alesis/audio/w.mp3",type="audio/mpeg")
audio.audio: source(src="https://rawcdn.githack.com/ricardoolivaalonso/Codepen/2afdb800797c6cd1fbfaf24ceba161cefc795eef/Alesis/audio/e.mp3",type="audio/mpeg")
audio.audio: source(src="https://rawcdn.githack.com/ricardoolivaalonso/Codepen/2afdb800797c6cd1fbfaf24ceba161cefc795eef/Alesis/audio/r.mp3",type="audio/mpeg")
audio.audio: source(src="https://rawcdn.githack.com/ricardoolivaalonso/Codepen/2afdb800797c6cd1fbfaf24ceba161cefc795eef/Alesis/audio/t.mp3",type="audio/mpeg")
audio.audio: source(src="https://rawcdn.githack.com/ricardoolivaalonso/Codepen/2afdb800797c6cd1fbfaf24ceba161cefc795eef/Alesis/audio/y.mp3",type="audio/mpeg")
audio.audio: source(src="https://rawcdn.githack.com/ricardoolivaalonso/Codepen/2afdb800797c6cd1fbfaf24ceba161cefc795eef/Alesis/audio/u.mp3",type="audio/mpeg")
audio.audio: source(src="https://rawcdn.githack.com/ricardoolivaalonso/Codepen/2afdb800797c6cd1fbfaf24ceba161cefc795eef/Alesis/audio/i.mp3",type="audio/mpeg")
audio.audio: source(src="https://rawcdn.githack.com/ricardoolivaalonso/Codepen/2afdb800797c6cd1fbfaf24ceba161cefc795eef/Alesis/audio/o.mp3",type="audio/mpeg")
audio.audio: source(src="https://rawcdn.githack.com/ricardoolivaalonso/Codepen/2afdb800797c6cd1fbfaf24ceba161cefc795eef/Alesis/audio/p.mp3",type="audio/mpeg")
audio.audio: source(src="https://rawcdn.githack.com/ricardoolivaalonso/Codepen/2afdb800797c6cd1fbfaf24ceba161cefc795eef/Alesis/audio/a.mp3",type="audio/mpeg")
audio.audio: source(src="https://rawcdn.githack.com/ricardoolivaalonso/Codepen/2afdb800797c6cd1fbfaf24ceba161cefc795eef/Alesis/audio/s.mp3",type="audio/mpeg")
audio.audio: source(src="https://rawcdn.githack.com/ricardoolivaalonso/Codepen/2afdb800797c6cd1fbfaf24ceba161cefc795eef/Alesis/audio/d.mp3",type="audio/mpeg")
audio.audio: source(src="https://rawcdn.githack.com/ricardoolivaalonso/Codepen/2afdb800797c6cd1fbfaf24ceba161cefc795eef/Alesis/audio/f.mp3",type="audio/mpeg")
audio.audio: source(src="https://rawcdn.githack.com/ricardoolivaalonso/Codepen/2afdb800797c6cd1fbfaf24ceba161cefc795eef/Alesis/audio/g.mp3",type="audio/mpeg")
audio.audio: source(src="https://rawcdn.githack.com/ricardoolivaalonso/Codepen/2afdb800797c6cd1fbfaf24ceba161cefc795eef/Alesis/audio/fa.mp3",type="audio/mpeg")
div.main#h
div.shadow
div.bls
- var n = 0
while n < 4
div.bl
div.bl__front.face
div.bl__back.face
div.bl__right.face
div.bl__left.face
div.bl__top.face
div.bl__bottom.face
- n++
div.a
div.a__front.face
div.a__back.face
div.a__right.face
div.a__left.face
div.a__top.face
div.a__bottom.face
div.b-left
div.b-left__front.face
div.b-left__back.face
div.b-left__plug
div.b-left__right.face
div.b-left__left.face
div.b-left__top.face
div.b-left__bottom.face
div.b-right
div.b-right__front.face
div.b-right__back.face
div.b-right__right.face
div.b-right__left.face
div.b-right__top.face
div.b-right__bottom.face
div.b-top
div.b-top__front.face
div.b-top__back.face
svg(version='1.0' xmlns='http://www.w3.org/2000/svg' width='15vw' height='3vw' viewbox='0 0 159.000000 29.000000' preserveaspectratio='xMidYMid meet')
g(transform='translate(0.000000,29.000000) scale(0.100000,-0.100000)' fill='#ffffff' stroke='none')
path(d='M144 148 l-129 -133 50 -3 50 -4 92 96 c51 53 95 96 98 96 3 0 5 -18\
5 -40 0 -40 0 -40 -38 -40 -29 0 -45 -7 -65 -28 -15 -15 -27 -31 -27 -35 0 -4\
29 -7 65 -7 58 0 65 -2 65 -20 0 -16 7 -20 35 -20 l35 0 0 118 c0 135 -8 152\
-72 152 -32 0 -47 -12 -164 -132z')
path(d='M410 137 c0 -78 3 -97 18 -110 17 -15 57 -17 369 -17 326 0 351 1\
366 18 10 10 17 35 17 55 0 53 -26 67 -122 67 -45 0 -78 4 -78 10 0 6 38 10\
95 10 l95 0 0 30 0 30 -114 0 c-107 0 -116 -1 -130 -22 -22 -31 -20 -74 4 -98\
17 -17 33 -20 101 -20 60 0 80 -3 77 -12 -4 -10 -52 -14 -189 -16 -187 -3\
-229 1 -229 18 0 6 38 10 90 10 l90 0 0 30 0 30 -90 0 c-53 0 -90 4 -90 10 0\
6 37 10 90 10 l90 0 0 30 0 30 -102 0 c-57 0 -108 -4 -114 -8 -22 -14 -34 -52\
-34 -106 l0 -56 -54 0 c-85 0 -86 1 -86 91 l0 79 -35 0 -35 0 0 -93z')
path(d='M1200 120 l0 -110 35 0 35 0 0 110 0 110 -35 0 -35 0 0 -110z')
path(d='M1316 208 c-22 -31 -20 -74 4 -98 17 -17 33 -20 101 -20 60 0 80 -3\
77 -12 -3 -9 -36 -14 -106 -16 -101 -3 -102 -3 -102 -27 l0 -25 124 0 c142 0\
156 6 156 70 0 56 -25 70 -122 70 -45 0 -78 4 -78 10 0 6 38 10 95 10 l95 0 0\
30 0 30 -114 0 c-107 0 -116 -1 -130 -22z')
div.b-top__right.face
div.b-top__left.face
div.b-top__top.face
svg(version='1.0' xmlns='http://www.w3.org/2000/svg' width='10vw' height='2vw' viewbox='0 0 159.000000 29.000000' preserveaspectratio='xMidYMid meet')
g(transform='translate(0.000000,29.000000) scale(0.100000,-0.100000)' fill='#ffffff' stroke='none')
path(d='M144 148 l-129 -133 50 -3 50 -4 92 96 c51 53 95 96 98 96 3 0 5 -18\
5 -40 0 -40 0 -40 -38 -40 -29 0 -45 -7 -65 -28 -15 -15 -27 -31 -27 -35 0 -4\
29 -7 65 -7 58 0 65 -2 65 -20 0 -16 7 -20 35 -20 l35 0 0 118 c0 135 -8 152\
-72 152 -32 0 -47 -12 -164 -132z')
path(d='M410 137 c0 -78 3 -97 18 -110 17 -15 57 -17 369 -17 326 0 351 1\
366 18 10 10 17 35 17 55 0 53 -26 67 -122 67 -45 0 -78 4 -78 10 0 6 38 10\
95 10 l95 0 0 30 0 30 -114 0 c-107 0 -116 -1 -130 -22 -22 -31 -20 -74 4 -98\
17 -17 33 -20 101 -20 60 0 80 -3 77 -12 -4 -10 -52 -14 -189 -16 -187 -3\
-229 1 -229 18 0 6 38 10 90 10 l90 0 0 30 0 30 -90 0 c-53 0 -90 4 -90 10 0\
6 37 10 90 10 l90 0 0 30 0 30 -102 0 c-57 0 -108 -4 -114 -8 -22 -14 -34 -52\
-34 -106 l0 -56 -54 0 c-85 0 -86 1 -86 91 l0 79 -35 0 -35 0 0 -93z')
path(d='M1200 120 l0 -110 35 0 35 0 0 110 0 110 -35 0 -35 0 0 -110z')
path(d='M1316 208 c-22 -31 -20 -74 4 -98 17 -17 33 -20 101 -20 60 0 80 -3\
77 -12 -3 -9 -36 -14 -106 -16 -101 -3 -102 -3 -102 -27 l0 -25 124 0 c142 0\
156 6 156 70 0 56 -25 70 -122 70 -45 0 -78 4 -78 10 0 6 38 10 95 10 l95 0 0\
30 0 30 -114 0 c-107 0 -116 -1 -130 -22z')
div.b-top__bottom.face
div.keys
- var n = 0
while n < 15
div.key-w
div.key-w__front.face
div.key-w__back.face
div.key-w__right.face
div.key-w__left.face
div.key-w__top.face
div.key-w__bottom.face
- n++
div.keys.keys--b
- var n = 0
while n < 10
div.key-b
div.key-b__front.face
div.key-b__back.face
div.key-b__right.face
div.key-b__left.face
div.key-b__top.face
div.key-b__bottom.face
- n++
div.controls
div.equ
- var i = 1
while i < 7
div.equ__item
div.circle.flex
div.circle-a
- var n = 0
while n < 36
div.circle-a__side
- n++
div.circle-a__bottom
p.equ__title k!{i}
- i++
div.buttons
- var n = 0
while n < 6
div.button
div.button__front.face
div.button__back.face
div.button__right.face
div.button__left.face
div.button__top.face
div.button__bottom.face
- n++
div.slots
- var n = 0
while n < 8
div.slot
div.slot__front.face
div.slot__back.face
div.slot__right.face
div.slot__left.face
div.slot__top.face
div.slot__bottom.face
- n++
h3.g#g gossip
$black-5: #000000;
$black-4: lighten($black-5, 2);
$black-3: lighten($black-5, 5);
$black-2: lighten($black-5, 7);
$black-1: lighten($black-5, 9);
$white-1: #ffffff;
$white-2: darken($white-1, 3);
$white-3: darken($white-2, 5);
$white-4: darken($white-3, 8);
$white-5: darken($white-4, 10);
$cyan-1: #00ffff;
$cyan-2: darken($cyan-1, 10);
$cyan-3: darken($cyan-1, 20);
$cyan-4: darken($cyan-1, 30);
$green-1: #00ff62;
$green-2: darken($green-1, 10);
$green-3: darken($green-1, 20);
$green-4: darken($green-1, 30);
$pink-1: #ff00c8;
$pink-2: darken($pink-1, 10);
$pink-3: darken($pink-1, 20);
$pink-4: darken($pink-1, 30);
$bg-1: #6E68d8;
$bg-2: darken($bg-1, 5);
/***********************/
@mixin cylinder($base, $sides, $degree, $pi, $width, $color) {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
&__side{
position: absolute;
height: ( 2 * $pi * ($base / 2) ) / $sides ;
width: $width;
background-color: darken($color, 15);
@for $var from 1 to ($sides + 1) {
&:nth-of-type(#{$var}){
transform: rotateX( $var * $degree / $sides ) translateZ($base / 2);
}
}
}
&__top,
&__bottom{
position: absolute;
width: $base;
height: $base;
border-radius: 50%;
transform: rotateY(90deg) translateZ( $width / 2 );
}
&__bottom{ transform: rotateY(90deg) translateZ( $width / -2 );}
}
@mixin cube($width, $height, $depth) {
&__front{ @include cube-front($width, $height, $depth); }
&__back{ @include cube-back($width, $height, $depth); }
&__right{ @include cube-right($width, $height, $depth); }
&__left{ @include cube-left($width, $height, $depth); }
&__top{ @include cube-top($width, $height, $depth);}
&__bottom{ @include cube-bottom($width, $height, $depth); }
}
//----------------------
@mixin cube-front($width, $height, $depth) {
width: $width;
height: $height;
transform-origin: bottom left;
transform: rotateX(-90deg) translateZ( -($height - ($depth * 2) ) );
}
@mixin cube-back($width, $height, $depth) {
width: $width;
height: $height;
transform-origin: top left;
transform: rotateX(-90deg) rotateY(180deg) translateX(-$width) translateY(-$height) ;
}
@mixin cube-right($width, $height, $depth) {
width: $depth * 2;
height: $height;
transform-origin: top left;
transform: rotateY(90deg) rotateZ(-90deg) translateZ($width) translateX(-$depth * 2) translateY(-$height);
}
@mixin cube-left($width, $height, $depth) {
width: $depth * 2;
height: $height;
transform-origin: top left;
transform: rotateY(-90deg) rotateZ(90deg) translateY(-$height);
}
@mixin cube-top($width, $height, $depth) {
width: $width;
height: $depth * 2;
transform-origin: top left;
transform: translateZ($height) ;
}
@mixin cube-bottom($width, $height, $depth) {
width: $width;
height: $depth * 2;
transform-origin: top left;
transform: rotateY(180deg) translateX(-$width);
}
@mixin face-ani($animation, $time, $side, $width-el, $height-el, $depth-el) {
animation: #{$animation} #{$time} infinite ease;
@keyframes #{$animation} {
0%, 15%, 45%, 60%, 62%, 68%{
@if $side == "cube-front" { @include cube-front($width-el, $height-el, $depth-el); }
@else if $side == "cube-back" { @include cube-back($width-el, $height-el, $depth-el); }
@else if $side == "cube-right" { @include cube-right($width-el, $height-el, $depth-el); }
@else if $side == "cube-left" { @include cube-left($width-el, $height-el, $depth-el); }
@else if $side == "cube-top" { @include cube-top($width-el, $height-el, $depth-el); }
@else if $side == "cube-bottom" { @include cube-bottom($width-el, $height-el, $depth-el); }
}
20%, 40%, 58%, 64%, 70%, 100%{
@if $side == "cube-front" { @include cube-front($width-el, $height-finish, $depth-el); }
@else if $side == "cube-back" { @include cube-back($width-el, $height-finish, $depth-el); }
@else if $side == "cube-right" { @include cube-right($width-el, $height-finish, $depth-el); }
@else if $side == "cube-left" { @include cube-left($width-el, $height-finish, $depth-el); }
@else if $side == "cube-top" { @include cube-top($width-el, $height-finish, $depth-el); }
@else if $side == "cube-bottom" { @include cube-bottom($width-el, $height-el, $depth-el); }
}
}
}
@mixin cube-color($color) {
&__front{ background-color: darken($color, 5); }
&__back{ background-color: darken($color, 10) }
&__right{ background-color: darken($color, 10) }
&__left{ background-color: darken($color, 20); }
&__top{ background-color: $color; }
&__bottom{ background-color: darken($color, 20);}
}
/***********************/
/***********************/
*, *::after, *::before {
margin: 0;
padding: 0;
box-sizing: border-box;
transform-style: preserve-3d;
user-select: none;
-webkit-tap-highlight-color: transparent;
appearance: none;
font-family: 'Wallpoet', cursive;
}
/***********************/
/***********************/
body{
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
width: 100%;
overflow: hidden;
cursor: pointer;
background-color: $bg-1;
}
.face{ position: absolute; }
.flex{
display: flex;
justify-content: center;
align-items: center;
}
/***********************/
/***********************/
.main{
position: absolute;
width: 61.25vw;
height: 25vw;
transform:
perspective(20000px)
rotateX(60deg)
rotateZ(30deg)
translateZ(-6vw)
;
transition: transform 50ms linear;
}
.shadow{
position: absolute;
width: 100%;
height: 100%;
background-color: $bg-2;
transform: translateZ(-8vw);
}
.g{
position: absolute;
top: 0;
left: 0;
transform-origin: top;
transform: translateZ(10vw) rotateX(-90deg);
font-size: 3vw;
text-transform: uppercase;
color: $white-1;
opacity: 0;
}
/*---------------------*/
.bls{
width: 100%;
height: 100%;
position: absolute;
transform: translateZ(-.75vw);
}
.bl{
$width-el: 4vw;
$height-el: .875vw;
$depth-el: 2vw;
@include cube($width-el, $height-el, $depth-el);
width: $width-el;
height: $depth-el * 2;
position: absolute;
&__front{ background-color: $black-3; }
&__back{ background-color: $black-5; }
&__right{ background-color: $black-5; }
&__left{ background-color: $black-3; }
&__top{ background-color: $black-5; }
&__bottom{ background-color: $black-5; }
&:nth-of-type(1){ left: 2vw; bottom: 2vw; }
&:nth-of-type(2){ right: 2vw; bottom: 2vw; }
&:nth-of-type(3){ left: 2vw; top: 2vw; }
&:nth-of-type(4){ right: 2vw; top: 2vw; }
}
.a{
$width-el: 61.25vw;
$height-el: 2vw;
$depth-el: 12.5vw;
@include cube($width-el, $height-el, $depth-el);
width: $width-el;
height: $depth-el * 2;
&__front{ background-color: $black-3; }
&__back{ background-color: $black-5; }
&__right{ background-color: $black-4; }
&__left{ background-color: $black-1; }
&__top{ background-color: $black-2; }
&__bottom{ background-color: $black-5; }
}
.b-left{
$width-el: 18vw;
$height-el: 3vw;
$depth-el: 12.5vw;
@include cube($width-el, $height-el, $depth-el);
width: $width-el;
height: $depth-el * 2;
position: absolute;
top: 0;
left: 0;
transform: translateZ(2vw);
&__front{ background-color: $black-3; }
&__back{ background-color: $black-5; }
&__right{ background-color: $black-4; }
&__left{ background-color: $black-1; }
&__top{ background-color: $black-2; }
// &__bottom{ background-color: $black-5; }
&__plug{
position: absolute;
right: 6vw;
top: calc(50% + .5vw);
width: 1vw;
height: 1vw;
border-radius: 50%;
border: .2vw solid rgba($white-1, 1);
}
}
.b-right{
$width-el: 2vw;
$height-el: 3vw;
$depth-el: 12.5vw;
@include cube($width-el, $height-el, $depth-el);
width: $width-el;
height: $depth-el * 2;
position: absolute;
top: 0;
right: 0;
transform: translateZ(2vw);
&__front{ background-color: $black-3; }
&__back{ background-color: $black-5; }
&__right{ background-color: $black-4; }
&__left{ background-color: $black-1; }
&__top{ background-color: $black-2; }
// &__bottom{ background-color: $black-5; }
}
.b-top{
$width-el: 41.25vw;
$height-el: 3vw;
$depth-el: 2vw;
@include cube($width-el, $height-el, $depth-el);
width: $width-el;
height: $depth-el * 2;
position: absolute;
top: 0;
left: 18vw;
transform: translateZ(2vw);
&__front{ background-color: $black-4; }
&__back{
background-color: $black-5;
padding-top: .75vw;
}
// &__right{ background-color: $black-4; }
// &__left{ background-color: $black-1; }
&__top{
background-color: $black-2;
display: flex;
justify-content: flex-end;
padding-top: 1vw;
}
// &__bottom{ background-color: $black-5; }
}
.keys{
width: 41.25vw;
height: 20.25vw;
position: absolute;
left: 18vw;
top: 4vw;
transform: translateZ(2vw);
&--b{ transform: translateZ(4.5vw);}
}
.key-w{
$width-el: 2.7vw;
$height-el: 2.4vw;
$depth-el: 10.125vw;
@include cube($width-el, $height-el, $depth-el);
width: $width-el;
height: $depth-el * 2;
position: absolute;
top: 0;
left: 0;
transition: transform 50ms linear;
&__front{ background-color: $white-4; }
&__back{ background-color: $white-5; }
&__right{ background-color: $white-5; }
&__left{ background-color: $white-5; }
&__top{ background-color: $white-2; }
&__bottom{ background-color: $white-5; }
@for $var from 0 to 15 {
&:nth-of-type(#{$var + 1}){ left: 2.75vw * $var; }
}
}
.key-b{
$width-el: 1.5vw;
$height-el: .6vw;
$depth-el: 6vw;
@include cube($width-el, $height-el, $depth-el);
width: $width-el;
height: $depth-el * 2;
position: absolute;
top: 0;
left: 0;
&__front{
&::before{
content: '';
position: absolute;
bottom: 0;
width: 100%;
height: 1.5vw;
transform-origin: bottom;
transform: rotateX(70deg);
background-color: $black-2;
}
}
&__back{ background-color: $black-5; }
&__right{ background-image: linear-gradient(-25deg, $black-4 5.1vw, transparent 5.1vw); }
&__left{ background-image: linear-gradient(25deg, $black-1 5.1vw, transparent 5.1vw); }
&__top{ background-image: linear-gradient(to bottom, $black-2 10.75vw, transparent 10.75vw); }
&__bottom{ background-color: $black-5; }
&:nth-of-type(1){ left: 2vw;}
&:nth-of-type(2){ left: 4.75vw;}
&:nth-of-type(3){ left: 10.25vw;}
&:nth-of-type(4){ left: 13vw;}
&:nth-of-type(5){ left: 15.75vw;}
&:nth-of-type(6){ left: 21.25vw;}
&:nth-of-type(7){ left: 24vw;}
&:nth-of-type(8){ left: 29.5vw;}
&:nth-of-type(9){ left: 32.25vw;}
&:nth-of-type(10){ left: 35vw;}
}
.controls{
display: grid;
grid-template-columns: 1fr;
grid-gap: .5vw;
width: 18vw;
height: 25vw;
position: absolute;
top: 0;
left: 0;
padding: 1.5vw;
transform: translateZ(5.01vw);
}
.slots{
display: grid;
grid-template-columns: repeat(4, 3.5vw);
grid-template-rows: repeat(2, 3.5vw);
grid-gap: .4vw;
}
.slot{
$width-el: 3.4vw;
$height-el: .4vw;
$depth-el: 1.75vw;
@include cube($width-el, $height-el, $depth-el);
width: $width-el;
height: $depth-el * 2;
&:nth-of-type(1),
&:nth-of-type(6){
.slot__front{ background-color: $white-2; }
.slot__back{ background-color: $white-4; }
.slot__right{ background-color: $white-3; }
.slot__left{ background-color: $white-1; }
.slot__top{
background-color: $black-4;
border: .15vw solid $white-1;
}
.slot__bottom{ background-color: $white-4; }
box-shadow:
.125vw .125vw .35vw rgba($white-1, .15),
-.125vw .125vw .35vw rgba($white-1, .15),
.125vw -.125vw .35vw rgba($white-1, .15),
-.125vw -.125vw .35vw rgba($white-1, .15)
;
}
&:nth-of-type(4){
.slot__front{ background-color: $green-2; }
.slot__back{ background-color: $green-4; }
.slot__right{ background-color: $green-3; }
.slot__left{ background-color: $green-1; }
.slot__top{
background-color: $black-4;
border: .15vw solid $green-1;
}
.slot__bottom{ background-color: $green-4; }
box-shadow:
.25vw .25vw .25vw rgba($green-1, .1),
-.25vw .25vw .25vw rgba($green-1, .1),
.25vw -.25vw .25vw rgba($green-1, .1),
-.25vw -.25vw .25vw rgba($green-1, .1)
;
}
}
.slot,
.button{
&__front{ background-color: $cyan-2; }
&__back{ background-color: $cyan-4; }
&__right{ background-color: $cyan-3; }
&__left{ background-color: $cyan-1; }
&__top{
background-color: $black-4;
border: .15vw solid $cyan-1;
}
&__bottom{ background-color: $cyan-4; }
box-shadow:
.125vw .125vw .35vw rgba($cyan-1, .075),
-.125vw .125vw .35vw rgba($cyan-1, .075),
.125vw -.125vw .35vw rgba($cyan-1, .075),
-.125vw -.125vw .35vw rgba($cyan-1, .075)
;
}
.buttons{
display: grid;
grid-template-columns: repeat(2, 2vw);
grid-template-rows: repeat(3, 2vw);
grid-gap: .4vw;
}
.button{
$width-el: 2vw;
$height-el: .4vw;
$depth-el: 1vw;
@include cube($width-el, $height-el, $depth-el);
width: $width-el;
height: $depth-el * 2;
&:nth-of-type(1){
.button__front{ background-color: $white-2; }
.button__back{ background-color: $white-4; }
.button__right{ background-color: $white-3; }
.button__left{ background-color: $white-1; }
.button__top{
background-color: $black-4;
border: .15vw solid $white-1;
}
.button__bottom{ background-color: $white-4; }
box-shadow:
.25vw .25vw .125vw rgba($white-1, .1),
-.25vw .25vw .125vw rgba($white-1, .1),
.25vw -.25vw .125vw rgba($white-1, .1),
-.25vw -.25vw .125vw rgba($white-1, .1)
;
}
&:nth-of-type(4){
.button__front{ background-color: $green-2; }
.button__back{ background-color: $green-4; }
.button__right{ background-color: $green-3; }
.button__left{ background-color: $green-1; }
.button__top{
background-color: $black-4;
border: .15vw solid $green-1;
}
.button__bottom{ background-color: $green-4; }
box-shadow:
.25vw .25vw .125vw rgba($green-1, .1),
-.25vw .25vw .125vw rgba($green-1, .1),
.25vw -.25vw .125vw rgba($green-1, .1),
-.25vw -.25vw .125vw rgba($green-1, .1)
;
}
}
.equ{
display: grid;
grid-template-columns: repeat(6, 2vw);
grid-gap: .65vw;
&__item{
display: grid;
grid-template-columns: 1fr;
place-content: center;
&:nth-of-type(1) .circle{ animation: equ-1 linear 1000ms infinite;}
&:nth-of-type(2) .circle{ animation: equ-2 linear 1000ms infinite;}
&:nth-of-type(4) .circle{ animation: equ-3 linear 1000ms infinite;}
&:nth-of-type(5) .circle{ animation: equ-4 linear 1000ms infinite;}
&:nth-of-type(6) .circle{ animation: equ-5 linear 1000ms infinite;}
}
&__title{
width: 100%;
text-align: center;
color: $white-2;
font-size: .75vw;
}
}
.circle{
$sides: 36;
$degree: 360deg;
$width: 1.5vw;
width: 2vw;
height: 2vw;
border: .25vw solid rgba($cyan-1, .8);
border-radius: 50%;
&-a{
$base: 1.5vw;
$pi: 3.5;
position: absolute;
width: $width;
height: $base;
transform: rotateY(90deg) translateX(-50%);
@include cylinder($base, $sides, $degree, $pi, $width, $black-1);
&__bottom{
background-color: $black-1;
&::before{
content: '';
position: absolute;
top: 0;
left: calc(50% - .075vw);
width: .15vw;
height: 60%;
background-color: $cyan-1;
}
}
}
}
/***********************/
/***********************/
.is-key-down{
// transform-origin: top;
transform: translateZ(-.5vw) rotateX(-3deg);
transition: transform 50ms linear;
.key-w__top{ background-color: lighten($pink-1, 45);}
}
.is-main-playing{ animation: main 500ms infinite; }
.is-text-visible{ animation: g linear 500ms infinite; }
@keyframes main {
0%, 90%, 100%{
transform:
perspective(20000px)
rotateX(60deg)
rotateZ(30deg)
translateZ(-6vw)
;
}
60%{
transform:
perspective(10000px)
rotateX(62deg)
rotateZ(32deg)
translateZ(-6vw)
;
}
}
@keyframes key-w { to{ transform: translateZ(-.5vw) rotateX(-3deg);} }
@keyframes g { to{opacity: 1;} }
@keyframes equ-1 {
0%, 30%, 90%, 100%{ transform: rotateZ(-20);}
50%, 70%{ transform: rotateZ(60deg);}
}
@keyframes equ-2 {
to{ transform: rotateZ(1turn);}
}
@keyframes equ-3 {
0%, 20%, 50%, 90%, 100%{ transform: rotateZ(-60);}
30%, 40%, 60%, 80%{ transform: rotateZ(40deg);}
}
@keyframes equ-4 {
0%, 20%, 50%, 90%, 100%{ transform: rotateZ(50deg);}
30%, 40%, 60%, 80%{ transform: rotateZ(80deg);}
}
@keyframes equ-5 {
0%, 20%, 40%, 60%, 80%, 100%{ transform: rotateZ(70deg);}
10%, 30%, 50%, 70%, 90%{ transform: rotateZ(120deg);}
}
const h = document.querySelector("#h");
const b = document.body;
const keyWhite = document.querySelectorAll('.key-w')
const audioSound = document.querySelectorAll('.audio')
const text = document.querySelector('#g')
/*****************/
/*****************/
const base = (e) => {
var x = e.pageX / window.innerWidth - 0.5;
var y = e.pageY / window.innerHeight - 0.5;
h.style.transform = `
perspective(20000px)
rotateX(${ y * 55 + 60}deg)
rotateZ(${ -x * 360 + 35}deg)
translateZ(-6vw)
`;
}
const playPianoFunc = (e) => {
let kc = event.keyCode;
if(kc==77){
b.removeEventListener("pointermove", base);
window.removeEventListener("keydown", playNoteFunc);
window.removeEventListener("keyup", pauseNoteFunc);
h.classList.add('is-main-playing')
audioSound[15].play()
text.classList.add('is-text-visible')
keyWhite.forEach( (k, i) => { k.style.animation = `key-w 500ms ease infinite ${i/10}s` })
setTimeout(()=>{
h.classList.remove('is-main-playing')
b.addEventListener("pointermove", base);
window.addEventListener("keydown", playNoteFunc);
window.addEventListener("keyup", pauseNoteFunc);
audioSound[15].pause()
audioSound[15].currentTime = 0
text.classList.remove('is-text-visible')
keyWhite.forEach( (k, i) => { k.style.animation = `none` })
}, 8000)
}
}
const playNoteFunc = (e) => {
let kc = event.keyCode;
console.log(kc)
switch (kc) {
case 81:
keyWhite[0].classList.add('is-key-down')
audioSound[0].play()
break;
case 87:
keyWhite[1].classList.add('is-key-down')
audioSound[1].play()
break;
case 69:
keyWhite[2].classList.add('is-key-down')
audioSound[2].play()
break;
case 82:
keyWhite[3].classList.add('is-key-down')
audioSound[3].play()
break;
case 84:
keyWhite[4].classList.add('is-key-down')
audioSound[4].play()
break;
case 89:
keyWhite[5].classList.add('is-key-down')
audioSound[5].play()
break;
case 85:
keyWhite[6].classList.add('is-key-down')
audioSound[6].play()
break;
case 73:
keyWhite[7].classList.add('is-key-down')
audioSound[7].play()
break;
case 79:
keyWhite[8].classList.add('is-key-down')
audioSound[8].play()
break;
case 80:
keyWhite[9].classList.add('is-key-down')
audioSound[9].play()
break;
case 65:
keyWhite[10].classList.add('is-key-down')
audioSound[10].play()
break;
case 83:
keyWhite[11].classList.add('is-key-down')
audioSound[11].play()
break;
case 68:
keyWhite[12].classList.add('is-key-down')
audioSound[12].play()
break;
case 70:
keyWhite[13].classList.add('is-key-down')
audioSound[13].play()
break;
case 71:
keyWhite[14].classList.add('is-key-down')
audioSound[14].play()
break;
default:
break;
}
}
const pauseNoteFunc = (e) => {
let kc = event.keyCode;
switch (kc) {
case 81:
keyWhite[0].classList.remove('is-key-down')
break;
case 87:
keyWhite[1].classList.remove('is-key-down')
break;
case 69:
keyWhite[2].classList.remove('is-key-down')
break;
case 82:
keyWhite[3].classList.remove('is-key-down')
break;
case 84:
keyWhite[4].classList.remove('is-key-down')
break;
case 89:
keyWhite[5].classList.remove('is-key-down')
break;
case 85:
keyWhite[6].classList.remove('is-key-down')
break;
case 73:
keyWhite[7].classList.remove('is-key-down')
break;
case 79:
keyWhite[8].classList.remove('is-key-down')
break;
case 80:
keyWhite[9].classList.remove('is-key-down')
break;
case 65:
keyWhite[10].classList.remove('is-key-down')
break;
case 83:
keyWhite[11].classList.remove('is-key-down')
break;
case 68:
keyWhite[12].classList.remove('is-key-down')
break;
case 70:
keyWhite[13].classList.remove('is-key-down')
break;
case 71:
keyWhite[14].classList.remove('is-key-down')
break;
default:
break;
}
}
/*****************/
/*****************/
b.addEventListener("pointermove", base);
window.addEventListener("keydown", playNoteFunc);
window.addEventListener("keyup", pauseNoteFunc);
window.addEventListener("keydown", playPianoFunc);
Also see: Tab Triggers