Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <html>

<head>
    <meta charset="utf-8">
    <title>Xbox Series</title>
    <meta name="viewport"
        content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
</head>

<body class="series-s">

    <div id="scene" class="scene">
        <div id="xbox" class="cube">
            <div class="shadow"></div>
            <div class="top">
                <div class="top-dots"></div>
            </div>
            <div class="right"></div>
            <div class="bottom"></div>
            <div class="left">
                <div class="logo-wrapper">
                    <div class="logo"></div>
                </div>
                <div class="button x-scale-0"></div>
                <div class="port x-scale-0"></div>
                <div class="disc-button s-scale-0"></div>
                <div class="disc-tray"></div>
            </div>
            <div class="front">
                <div class="circle x-scale-0">
                    <div class="circle-dots"></div>
                </div>
            </div>
            <div class="back"></div>
        </div>
    </div>

    <div class="series-logo-wrapper">
        <div id="seriesXBtn" class="series-logo series-logo-x">
            <span>X</span>
        </div>
        <div class="series-logo-divider"></div>
        <div id="seriesSBtn" class="series-logo series-logo-s">
            <span>S</span>
        </div>
    </div>

</body>

</html>
              
            
!

CSS

              
                :root {
    --height: 55vw;
    --width: 30.2vw;
    --depth: 12.6vw;
    --seriess: #E7E7E7;
    --seriesx: #1F1E25;
    --view: -222deg;
}

/*
Series S: 15.1 cm × 6.5 cm × 27.5 cm (5.9 in × 2.6 in × 11 in)
Series X: 15.1 cm × 15.1 cm × 30.1 cm (5.9 in × 5.9 in × 11.9 in) 
*/

body {
    background: #E7E7E7;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

body {
    transition: background 1s ease;
}

.scene {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 5vw;
    transform: scale(.4);
}

@media screen and (orientation:portrait) {
    .scene {
        transform: scale(1);
    }
}

@media screen and (orientation:landscape) {
    .scene {
        transform: scale(.5);
    }
}

.scene * {
    transition: all 1s ease;
}

.cube,
.cube * {
    transform-style: preserve-3d;
}

.cube,
.shadows {
    position: absolute;
    height: var(--height);
    width: var(--width);
    transform: rotateX(-15deg) rotateY(var(--view)) rotateZ(0) translateZ(-2vw);
}

.top {
    height: var(--depth);
    width: 100%;
    bottom: 100%;
    position: absolute;
    transform: translateY(50%) rotateX(90deg);
}

.bottom {
    height: var(--depth);
    width: 100%;
    top: 100%;
    position: absolute;
    transform: translateY(-50%) rotateX(90deg);
}

.right {
    width: var(--depth);
    height: 100%;
    left: 100%;
    position: absolute;
    transform: translateX(-50%) rotateY(90deg);
}

.left {
    width: var(--depth);
    height: 100%;
    right: 100%;
    position: absolute;
    transform: translateX(50%) rotateY(-90deg);
}

.front {
    height: var(--height);
    width: 100%;
    top: 100%;
    position: absolute;
    transform: translateY(-100%) translateZ(calc(var(--depth) * -.5)) rotateY(180deg);
    transform-origin: center top;
}

.back {
    height: var(--height);
    width: 100%;
    bottom: 100%;
    position: absolute;
    transform: translateY(100%) translateZ(calc(var(--depth) * .5)) rotateY(0deg);
    transform-origin: center bottom;
}

// COMPONENTS

.circle {
    border-radius: 50%;
    width: 90%;
    height: 50%;
    margin: auto;
    margin-top: 10%;
    background: #3F4041;
    border: 2px solid rgba(0, 0, 0, 0.75);
    position: relative;
    text-align: center;
    display: flex;
    overflow: hidden;
    backface-visibility: hidden;
}

.circle-dots {
    width: 97%;
    height: 97%;
    margin: auto;
    border-radius: 50%;
    overflow: hidden;

    &::before {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        background-size: .9vw .9vw;
        background-image: radial-gradient(#000 50%, transparent 50%);
        content: '';
    }
}

.disc-button {
    background: #545559;
    border-radius: 50%;
    border: .2vw solid #07090A;
    bottom: 53%;
    left: 10%;
    width: 1.5vw;
    height: 1.5vw;
    position: absolute;
}

.disc-tray {
    background: #07090A;
    bottom: 0%;
    left: 10%;
    right: unset;
    width: 6%;
    height: 50%;
    border-top-left-radius: 1vw;
    border-top-right-radius: 1vw;
    position: absolute;
}

.top-dots {
    position: absolute;
    top: 10%;
    right: 5%;
    left: 5%;
    bottom: 10%;
    background-size: 10px 10px;
    background-image: radial-gradient(#ccc 50%, transparent 50%);
}

.port {
    background: #000;
    bottom: 5%;
    right: 15%;
    width: 10%;
    height: 6%;
    position: absolute;
}

.button {
    background: #000;
    border-radius: 50%;
    bottom: 14%;
    right: 15%;
    width: 1.5vw;
    height: 1.5vw;
    position: absolute;
}

// SERIES S

.series-s {
    background: var(--seriess);
    color: var(--seriesx);

    .series-logo-divider {
        background-color: var(--seriesx);
    }

    .series-logo-s {
        opacity: .5;
    }

    .cube {

        .front {
            background: #E8E8EA;
        }

        .logo-wrapper {
            left: 15%;
            top: 6%;
            transform: scale(.25);
            transform-origin: top left;
        }

        .logo {
            background: #3F4041;
            transform: rotateZ(270deg);

            &:before {
                border-top-color: #AEAFB0;
            }

            &:after {
                border-top-color: #AEAFB0;
            }
        }

        .left {
            background: #AEAFB0;
        }

        .top {
            background: #FBFBFD;
        }

        .disc-tray {
            height: 0;
        }

        .s-scale-0 {
            transform: scale(0);
        }

    }
}

// SERIES X

.series-x {
    background: var(--seriesx);
    color: var(--seriess);

    .series-logo-divider {
        background-color: var(--seriess);
    }

    .series-logo-x {
        opacity: .5;
    }

    .x-scale-0 {
        transform: scale(0);
    }

    .cube {
        .logo {
            background: #FEFEFE;
        }

        .front {
            background: #2B2C2E;
        }

        .logo-wrapper {
            left: -3%;
            top: 0;
            transform: scale(.32);
        }

        .logo {
            background: #FEFEFE;

            &:before {
                border-top-color: #505155;
            }

            &:after {
                border-top-color: #505155;
            }
        }

        .left {
            background: #505155;
        }

        .top {
            background: #6D6E72;
        }

        .top-dots {
            position: absolute;
            top: 2%;
            right: 2%;
            left: 2%;
            bottom: 2%;
            background-size: 2.4vw 2.4vw;
            background-image: radial-gradient(#171918 50%, transparent 50%);
        }

    }
}

.shadow {
    transform-origin: bottom left;
    height: var(--height);
    width: 100%;
    top: 100%;
    position: absolute;
    background-color: rgba(0, 0, 0, .75);
    transform: translateY(-100%) translateZ(calc(var(--depth) * .5)) rotateX(270deg);
}

// LOGO

.logo-wrapper {
    position: absolute;
}

.logo {
    background: white;
    position: relative;
    left: 0;
    top: 0;
    border-radius: 50%;
    width: 10.909vw;
    height: 10.909vw;
    overflow: hidden;

    &:before {
        content: '';
        border-top: 2.121vw solid black;
        width: 13.515vw;
        height: 10.667vw;
        position: absolute;
        border-radius: 50%;
        left: -34%;
        top: 10%;
        transform: rotate(36deg);
    }

    &:after {
        content: '';
        border-top: 2.121vw solid black;
        width: 13.515vw;
        height: 10.667vw;
        position: absolute;
        border-radius: 50%;
        right: -34%;
        top: 10%;
        -webkit-transform: rotate(36deg);
        transform: rotate(-37deg);
    }
}

// SERIES LOGO

.series-logo-wrapper {
    font-weight: 600;
    display: flex;
    flex-direction: row;
    line-height: 1;
    position: absolute;
    bottom: 4vh;
    opacity: .7;
    transition: all .5s ease;
}

.series-logo {
    font-size: 4vw;
    padding: 0 1vw;
    cursor: pointer;
    transition: all .5s ease;

    &:hover {
        opacity: .5;
    }
}

.series-logo-divider {
    width: .3vw;
    margin: .4vw 0;
}
              
            
!

JS

              
                /*
		Created by: Justin Alexander
*/

let b = document.body;
let xbox = document.querySelector("#xbox");
let seriesSBtn = document.querySelector("#seriesSBtn");
let seriesXBtn = document.querySelector("#seriesXBtn");
let initialView = -222;
let seriesX = {
  height: 60.2,
  width: 30.2,
  depth: 30.2
};
let seriesS = {
  height: 55,
  width: 30.2,
  depth: 12.6
};

let seriesSSelected = () => {
  setProperties(seriesS);
  b.classList.add("series-s");
  b.classList.remove("series-x");
};

let seriesXSelected = () => {
  setProperties(seriesX);
  b.classList.add("series-x");
  b.classList.remove("series-s");
};

let setProperties = (props) => {
  document.documentElement.style.setProperty("--width", props.width + "vw");
  document.documentElement.style.setProperty("--height", props.height + "vw");
  document.documentElement.style.setProperty("--depth", props.depth + "vw");
};

let onMouseMove = (e) => {
  xPercent = parseInt((e.pageX / window.innerWidth) * 100) - 75;

  var view = initialView;
  view += xPercent / 2;
  document.documentElement.style.setProperty("--view", view + "deg");
  console.log(xPercent);
};

let onMouseLeave = (e) => {
  document.documentElement.style.setProperty("--view", initialView + "deg");
};

seriesSBtn.addEventListener("click", seriesSSelected);
seriesXBtn.addEventListener("click", seriesXSelected);
b.addEventListener("mousemove", onMouseMove);
b.addEventListener("mouseleave", onMouseLeave);

              
            
!
999px

Console