Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              div, div::before, div::after {
  position: relative;
  box-sizing: border-box;

div {
  --color1: hsl(196, 50%, 50%);
  --color1alt: hsl(196, 50%, 30%);
  --color2: hsl(356, 70%, 50%);
  --color3alt: hsl(43, 80%, 50%);
  --height: 40vmin;
  --bellow-width: 50vmin;
  /* Default Button Radius */
  --button-dim: 1.4vmin;
  /*Default Button Radial Gradient/Shape */
  --button: radial-gradient(circle, var(--color1) var(--button-dim), transparent var(--button-dim));
  /* Since I want to animate a few buttons, set up specific button definitions: for 1, 4, 7, and 8. This will allow us to animate them individually later */
  --button1: radial-gradient(circle, var(--button1-color, var(--color1)) var(--button1-dim, var(--button-dim)), transparent var(--button1-dim, var(--button-dim)));
  --button4: radial-gradient(circle, var(--button4-color, var(--color1)) var(--button4-dim, var(--button-dim)), transparent var(--button4-dim, var(--button-dim)));
  --button7: radial-gradient(circle, var(--button7-color, var(--color1)) var(--button7-dim, var(--button-dim)), transparent var(--button7-dim, var(--button-dim)));
  --button8: radial-gradient(circle, var(--button8-color, var(--color1)) var(--button8-dim, var(--button-dim)), transparent var(--button8-dim, var(--button-dim)));
  /* Default Background Position */
  --button-x: -3vmin;
  --button-y: -16vmin;
  /* Override Default positions to give each button a unique position that is staggered */
  --button2-x: 2vmin; --button2-y: -12vmin;
  --button3-y: -8vmin;
  --button4-x: 2vmin; --button4-y: -4vmin;
  --button5-y: 0vmin;
  --button6-x: 2vmin; --button6-y: 4vmin;
  --button7-y: 8vmin;
  --button8-x: 2vmin; --button8-y: 12vmin;
  --button9-y: 16vmin;
  /* Red lines at top and bottom */
  --shine-horizontal: linear-gradient(to right, transparent 9.5%, var(--color2) 41.5%, var(--color2) 58.5%, transparent 86.5%);

/* button side of accordion */
div::after {
  height: calc(var(--height) + 7.5vmin);
  width: calc(var(--bellow-width) * .30);
  top: 0;
  bototm: 0;
  border-radius: 1vmin 4vmin 4vmin 1vmin; 
  /* Layered backgrounds, first is topmost background.
  For the buttons, use the specific ones if defined (1,4,7,8) otherwise use default definition. Only reason we give a specific one is to modify values later (in JS). */
    var(--button1, var(--button)), 
    var(--button2, var(--button)),
    var(--button3, var(--button)),
    var(--button4, var(--button)),
    var(--button5, var(--button)),
    var(--button6, var(--button)),
    var(--button7, var(--button)),
    var(--button8, var(--button)),
    var(--button9, var(--button)),
    /* The base of the right accordion side */
    linear-gradient(var(--color3alt), var(--color3alt));
  background-repeat: no-repeat;
  /* Structured to use button*-x if defined, otherwise use the default assigned to button-x. Same for y */
    1.5vmin 8%,
    1.5vmin 92%,
    var(--button1-x, var(--button-x)) var(--button1-y, var(--button-y)),
    var(--button2-x, var(--button-x)) var(--button2-y, var(--button-y)),
    var(--button3-x, var(--button-x)) var(--button3-y, var(--button-y)),
    var(--button4-x, var(--button-x)) var(--button4-y, var(--button-y)),
    var(--button5-x, var(--button-x)) var(--button5-y, var(--button-y)),
    var(--button6-x, var(--button-x)) var(--button6-y, var(--button-y)),
    var(--button7-x, var(--button-x)) var(--button7-y, var(--button-y)),
    var(--button8-x, var(--button-x)) var(--button8-y, var(--button-y)),
    var(--button9-x, var(--button-x)) var(--button9-y, var(--button-y)),
    center center;
  --default-size: 100%;
    80% 2px,
    80% 2px,
  box-shadow: inset -1vmin 0px 0px 1vmin rgba(235,235,239,.2);

div::before, div::after {
  content: '';
  position: absolute;
div {
  height: var(--height);
body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
  background: hsl(33, 80%, 9%);

              var div = document.querySelector('div');
var buttons = {};
const newDim = '1.2vmin';

function startIntervals() {
  setInterval(() => { pressButton(1) }, 900);
  setInterval(() => { pressButton(4) }, 1200);
  setInterval(() => { pressButton(7) }, 1600);
  setInterval(() => { pressButton(8) }, 1700);

function pressButton(index) {
  requestAnimationFrame(function() {
    var enabled = !!buttons[index];'--button'+index+'-dim', enabled ? newDim : 'var(--button-dim)');'--button'+index+'-color', enabled ? 'var(--color1alt)' : 'var(--color1)');
    buttons[index] = !enabled;

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.