Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

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.

+ add another resource

Packages

Add Packages

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.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                div.main#h
    div.shadow
    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
        div.b__front.face 
        div.b__back.face 
        div.b__right.face 
        div.b__left.face 
        div.b__top.face 
        div.b__bottom.face
    
    div.cube
        div.cube__shadow
        div.cube__front.face.flex ?
        div.cube__back.face.flex ?
        div.cube__right.face.flex ?
        div.cube__left.face.flex ?
        div.cube__top.face.flex ?
        div.cube__bottom.face.flex ?
    
    div.coin
        div.coin__shadow
        div.circle.flex
            div.circle-a  
                - var n = 0
                while n < 36
                    div.circle-a__side
                    - n++
                div.circle-a__bottom
                div.circle-a__top
            div.circle-b  
                - var n = 0
                while n < 36
                    div.circle-b__side
                    - n++
                div.circle-b__top.flex

    div.pipe.flex
        div.circle.flex
            div.circle-a  
                - var n = 0
                while n < 36
                    div.circle-a__side
                    - n++
                div.circle-a__bottom
                div.circle-a__top
            div.circle-b  
                - var n = 0
                while n < 36
                    div.circle-b__side
                    - n++   
    div.pipe.pipe--t.flex
        div.circle.flex
            div.circle-a  
                - var n = 0
                while n < 36
                    div.circle-a__side
                    - n++
                div.circle-a__bottom
            div.circle-b  
                - var n = 0
                while n < 36
                    div.circle-b__side
                    - n++
    div.goomba
    - var n = '<br>'
    span.text MINI!{n}WORLD
              
            
!

CSS

              
                $white-1: #dddddd;
$white-2: darken($white-1, 5);
$white-3: darken($white-1, 10);
$white-4: darken($white-1, 15);
$white-5: darken($white-1, 20);

$green-1: #01bd01;
$green-2: darken($green-1, 8);
$green-3: darken($green-1, 15);
$green-4: darken($green-1, 20);
$green-5: darken($green-1, 25);

$floor-1: #dd6d38;
$floor-2: darken($floor-1, 8);
$floor-3: darken($floor-1, 12);
$floor-4: darken($floor-1, 18);
$floor-5: darken($floor-1, 25);

$coin-1: #f8c322;
$coin-2: darken($coin-1, 10);
$coin-3: darken($coin-1, 15);
$coin-4: darken($coin-1, 20);
$coin-5: darken($coin-1, 25);

$cube-1: #daa113;
$cube-2: darken($cube-1, 5);
$cube-3: darken($cube-1, 10);
$cube-4: darken($cube-1, 15);
$cube-5: darken($cube-1, 20);

$bg-1: #5b7efd;
$bg-2: darken($bg-1, 8);

/***********************/
@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);
            }
        }
        @for $var from 1 to 20 {
            &:nth-of-type(#{$var}){
                background-color: darken($color, $var * .5);
            }
        }
        @for $var from 1 to 20 {
            &:nth-last-of-type(#{$var}){
                background-color: darken($color, $var * .5);
            }
        }
    }
    &__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: 'Press Start 2P', cursive;
}
/***********************/
/***********************/
body{
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100%;

    overflow: hidden;
	cursor: pointer;
    background-color: $bg-1;
    color: white;
}
.face{ position: absolute; }
.flex{
    display: flex;
    justify-content: center;
    align-items: center;
}
/***********************/
/***********************/
.main{
    position: absolute;
    width: 30vw;
    height: 30vw;
    transform:
        perspective(20000px)
        rotateX(60deg)
        rotateZ(30deg)
        translateZ(-10vw)
    ;
    transition: transform 50ms linear;
}
.shadow{
    position: absolute;
    right: -2%;
    bottom: -2%;
    width: 106%;
    height: 106%;
    transform: translateZ(0vw);
    background-color: $bg-2;

    box-shadow:
        .5vw .5vw .5vw $bg-2,
        -.5vw .5vw .5vw $bg-2,
        .5vw -.5vw .5vw $bg-2,
        -.5vw -.5vw .5vw $bg-2
    ;
}
/*---------------------*/
.a{
    $width-el: 30vw;
    $height-el: 4vw;
    $depth-el: 15vw;
    
    @include cube($width-el, $height-el, $depth-el);
    position: absolute;
    width: $width-el;
    height: $depth-el * 2;

    &__front{ 
        background-color: $floor-3; 
        border-bottom: .5vw solid $green-3;
    }
    &__back{ 
        background-color: $floor-4;
        border-bottom: .5vw solid $green-4;
    }
    &__right{ 
        background-color: $floor-1; 
        border-bottom: .5vw solid $green-1;
    }
    &__left{ 
        background-color: $floor-4;
        border-bottom: .5vw solid $green-4;
    }
    &__top{ 
        background-color: $green-1;           
        background-image:  
            repeating-linear-gradient(45deg, $green-2 25%, transparent 25%, transparent 75%, $green-2 75%, $green-2), 
            repeating-linear-gradient(45deg, $green-2 25%, transparent 25%, transparent 75%, $green-2 75%, $green-2);
            background-position: 0 0, 5vw 5vw;
            background-size: 10vw 10vw
        ;
    }
    &__bottom{  background-color: $floor-5; }
}
.b{
    $width-el: 20vw;
    $height-el: 4vw;
    $depth-el: 7.5vw;
    
    @include cube($width-el, $height-el, $depth-el);
    position: absolute;
    top: 0;
    left: 0;
    width: $width-el;
    height: $depth-el * 2;
    transform: translateZ(4vw);

    &__front{ background-image: linear-gradient(39deg, $floor-3 12.6vw, transparent 12.6vw); }
    &__back{ background-image: linear-gradient(-39deg, $floor-4 12.6vw, transparent 12.6vw); }
    // &__right{}
    &__left{ background-color: $floor-4; }
    &__top{ 
        background-image: linear-gradient(to right, $floor-2 15vw, transparent 15vw);

        &::after{
            content: '';
            position: absolute;
            height: 100%;
            width: 15vw;

            background-color: $green-1;           
            background-image:  
                repeating-linear-gradient(45deg, $green-2 25%, transparent 25%, transparent 75%, $green-2 75%, $green-2), 
                repeating-linear-gradient(45deg, $green-2 25%, transparent 25%, transparent 75%, $green-2 75%, $green-2);
                background-position: 0 0, 5vw 5vw;
                background-size: 10vw 10vw;
        }
        &::before{
            content: '';
            position: absolute;
            right: -1.5vw;
            width: 6.5vw;
            height: 100%;
            transform-origin: left;
            transform: rotateY(39deg);

            background-color: $green-2;           
            background-image:  
                repeating-linear-gradient(45deg, $green-1 25%, transparent 25%, transparent 75%, $green-1 75%, $green-1),
                repeating-linear-gradient(45deg, $green-1 25%, transparent 25%, transparent 75%, $green-1 75%, $green-1);
            background-position: 0 0, 5vw 5vw;
            background-size: 10vw 10vw;
        }
    }
    &__bottom{  background-color: $floor-5; }
}
.cube{
    $width-el: 5vw;
    $height-el: 5vw;
    $depth-el: 2.5vw;
    
    @include cube($width-el, $height-el, $depth-el);
    width: $width-el;
    height: $depth-el * 2;
    position: absolute;
    bottom: 5vw;
    left: 5vw;
    transform: translateZ(10vw);

    &__front{ 
        background-color: $cube-3;
        border: .3vw solid $floor-3;
        color: $floor-3;
    }
    &__back{ 
        background-color: $cube-5;
        border: .3vw solid $floor-5;
        color: $floor-5;
    }
    &__right{ 
        background-color: $cube-1;
        border: .3vw solid $floor-1;
        color: $floor-1;
    }
    &__left{ 
        background-color: $cube-4;
        border: .3vw solid $floor-4;
        color: $floor-4;
    }
    &__top{ 
        background-color: $cube-2;
        border: .3vw solid $floor-2;
        color: $floor-2;
    }
    &__bottom{ 
        background-color: $cube-5;
        border: .3vw solid $floor-5;
        color: $floor-5;
    }
    &__shadow{
        position: absolute;
        top: -10%;
        left: -10%;
        width: 120%;
        height: 120%;
        transform: translateZ(-5.99vw);
        background-color: darken($green-2, 5);
        box-shadow:
            .5vw .5vw .5vw darken($green-2, 5),
            -.5vw .5vw .5vw darken($green-2, 5),
            .5vw -.5vw .5vw darken($green-2, 5),
            -.5vw -.5vw .5vw darken($green-2, 5)
        ;
    }
    .face{
        font-size: 2.5vw;
        text-shadow: .2vw .2vw 0 rgba(black, .75);

    }
}
.coin{
    position: absolute;
    top: 7.5vw;
    right: 5vw;
    transform: translateZ(12vw) rotateX(90deg);
    
    animation: coin 4000ms linear infinite;

    &__shadow{
        position: absolute;
        top: 0;
        left: -2.75vw;
        width: 6vw;
        height: 1vw;
        transform: translateY(-8.5vw) rotateX(-90deg);
        background-color: darken($green-2, 5);
        box-shadow:
            .25vw .25vw .25vw darken($green-2, 5),
            -.25vw .25vw .25vw darken($green-2, 5),
            .25vw -.25vw .25vw darken($green-2, 5),
            -.25vw -.25vw .25vw darken($green-2, 5)
        ;
        border-radius: .5vw;
    }
    .circle{   
        $sides: 36;
        $degree: 360deg;
        $width: 1vw;   

        &-a{
            $base: 6vw;
            $pi: 3.5;
            position: absolute;
            width: $width;
            height: $base;
            transform: rotateY(90deg) translateX(-50%);

            @include cylinder($base, $sides, $degree, $pi, $width, $coin-1);

            &__top{ border: 1vw solid darken($coin-2, 2);}
            &__bottom{ border: 1vw solid darken($coin-2, 2);}
        }
        &-b{
            $base: 4vw;
            $pi: 3.5;
            position: absolute;
            width: $width;
            height: $base;
            transform: rotateY(90deg) translateX(-50%);

            @include cylinder($base, $sides, $degree, $pi, $width, $coin-2);

            &__top{ 
                background-color: darken($coin-2, 6);
                transform: rotateY(90deg);

                &::before{
                    content: '';
                    position: absolute;
                    width: 1vw;
                    height: 2vw;
                    background-color: $coin-2;
                    border-radius: .5vw;
                }
            }
        }
    }
}
.pipe{
    position: absolute;
    top: 3vw;
    left: 3vw;
    transform: translateZ(8vw);

    width: 8.5vw;
    height: 8.5vw;
    border-radius: 50%;
    border: .35vw solid darken($green-2, 8);
    box-shadow:
        .25vw .25vw .25vw darken($green-2, 5),
        -.25vw .25vw .25vw darken($green-2, 5),
        .25vw -.25vw .25vw darken($green-2, 5),
        -.25vw -.25vw .25vw darken($green-2, 5)
    ;

    .circle{   
        $sides: 36;
        $degree: 360deg;
        $width: 5vw;   
        
        &-a{
            $base: 8vw;
            $pi: 3.5;

            position: absolute;
            width: $width;
            height: $base;
            transform: rotateY(90deg) translateX(-50%);

            @include cylinder($base, $sides, $degree, $pi, $width, $green-2);

            &__bottom{ border: 1vw solid darken($green-2, 8);}
            &__top{ background-color: $green-3; }
        }
        &-b{
            $base: 6vw;
            $pi: 3.5;

            position: absolute;
            width: $width;
            height: $base;
            transform: rotateY(90deg) translateX(-50%);

            @include cylinder($base, $sides, $degree, $pi, $width, darken($green-3, 5));
        }
    }

    &--t{ 
        transform: translateZ(12vw); 
        border: none;
        box-shadow: none;
        
        .circle{   
            $sides: 36;
            $degree: 360deg;
            $width: 3vw;   

            &-a{
                $base: 9vw;
                $pi: 3.5;
                position: absolute;
                width: $width;
                height: $base;
                transform: rotateY(90deg) translateX(-50%);
    
                @include cylinder($base, $sides, $degree, $pi, $width, $green-2);
                &__bottom{ border: 1vw solid $green-2;}
            }
            &-b{
                $base: 7vw;
                $pi: 3.5;
                position: absolute;
                width: $width;
                height: $base;
                transform: rotateY(90deg) translateX(-50%);
                @include cylinder($base, $sides, $degree, $pi, $width, $green-3);
            }
            &-a,
            &-b{ 
                &__side{
                    border-left: .25vw solid darken($green-2, 15);
                    border-right: .25vw solid darken($green-2, 15);
                }
            }
        }
    }
}
.text{
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: top;
    transform: translateZ(20vw) rotateX(-90deg);
    font-size: 1vw;
    line-height: 1.4;
    opacity: .65;

    animation: text 1000ms linear infinite;
}
@keyframes coin {
    to{ transform: translateZ(12vw) rotateX(90deg) rotateY(1turn); }
}
@keyframes text {
    50%, 100%{ opacity: 1; }
}
              
            
!

JS

              
                const h = document.querySelector("#h");
const b = document.body;
/*****************/
/*****************/
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 * 20  + 60}deg)
        rotateZ(${ -x * 360  }deg)
        translateZ(-10vw)
    `;
}
/*****************/
/*****************/
b.addEventListener("pointermove", base);



              
            
!
999px

Console