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

              
                <section id="container" class="card">
  <header>
    <div id="subtitle-container">
    <h5 class="active">Just say</h5>
      <h5>Now Say</h5>
      <h5>Then say</h5>
      <h5>Next Say</h5>
      <h5>Finally Say</h5>
    </div>
    <div id="heading-container" class="heading-container">
      <h3 class="active">&ldquo;Hey Skullcandy&rdquo;</h3>
      <h3>&ldquo;Hey Skullcandy&rdquo;</h3>
      <h3>&ldquo;Hey Skullcandy&rdquo;</h3>
      <h3>&ldquo;Hey Skullcandy&rdquo;</h3>
      <h3>&ldquo;Will there be sunshine tomorrow?&rdquo;</h3>
    </div>
  </header>
  <div id="button" class="button">
    <div class="button-text">Press and hold to record while you speak</div>
  </div>
  <nav>
    <div class="dot active"></div>
    <div class="dot"></div>
    <div class="dot"></div>
    <div class="dot"></div>
    <div class="dot"></div>
  </nav>
</section>
              
            
!

CSS

              
                * {
  box-sizing: border-box;
}

body {
  background: #000;
  font-family: "Inter", sans-serif;
  color: #fff;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 40px;
}

.card {
  border: 1px solid;
  padding-top: 6rem;
  border-image-source: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0) 100%
  );

  border-radius: 24px;
  padding: 6rem 1rem 3rem 1rem;
  text-align: center;
  width: 328px;
  margin: 0 auto;
  background: radial-gradient(
        93.26% 40.59% at 1.33% 0.52%,
        #313538 0%,
        rgba(31, 32, 33, 0) 100%
      )
      /* warning: gradient uses a rotation that is not supported by CSS and may not behave as expected */,
    linear-gradient(0deg, #1f2021, #1f2021);
  display: flex;
  flex-direction: column;
  justify-content: space-between;

  height: 768px;
}


#subtitle-container {
  height: 17px;
  position: relative;
  width: 280px;
}

h5, 
h3 {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  margin: 0;
  opacity: 0;
  
  &.active {
    opacity: 1;
  }
}

h5 {
font-size: 12px;
font-style: normal;
font-weight: 600;
line-height: 17px;
letter-spacing: 0.04em;
text-align: center;
  text-transform: uppercase;
  color: rgba(181, 181, 181, 1);
  margin-bottom: 0;
  transition: all .3s ease-out;
  
  &.active {
    transition: all .4s cubic-bezier(0.33, 1, 0.68, 1) .3s;
  }
  
}

.heading-container {
  height: 62px;
  position: relative;
   width: 280px;
}

h3 {
  font-size: 1.5rem;
  margin: 0;
  font-weight: 800;
  line-height: 31px;
  letter-spacing: -0.03em;
  text-align: center;
  transform: translateY(12px);
  transition: opacity .3s ease-out 0s, transform 0s linear .4s;
  
  &.active {
    transition: all .4s cubic-bezier(0.33, 1, 0.68, 1) .3s;
    transform: translateY(0);
  }
}

// $button-gradient: linear-gradient(203.58deg, #01C41F 3.82%, #007AFF 44.64%, #7601B9 89.95%);

$button-gradient: linear-gradient(204deg, rgba(0,122,255,1) 0%, rgba(1,196,31,1) 25%, rgba(0,122,255,1) 50%, rgba(118,1,185,1) 75%, rgba(0,122,255,1) 100%);

@keyframes gradientAnimation {
    0%{background-position:0% 50%}
    50%{background-position:100% 50%}
    100%{background-position:0% 50%}
}

.button {
  width: 280px;
  height: 280px;
  border-radius: 50%;
  text-align: center;
  padding: 45px;
  background: $button-gradient;
  background-size: 350% 350%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center; 
  position: relative;
  cursor: pointer;
  animation: gradientAnimation 13s ease infinite;
  
  &:after {
    content: '';
    position: absolute;
    left: 3px;
    right: 3px;
    bottom: 3px; 
    top: 3px;
    z-index: 1;
    background: rgba(31,32,33,1);
    border-radius: 50%;
    transition: opacity .25s ease-out;
  }
  
  &.pressed:after {
     opacity: 0;
  }
  
  
  
}

.button-text {
  position: relative;
  z-index: 2;
}

nav {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.dot {
  width: 9px;
  height: 9px;
  background: rgba(74, 74, 74, 1);
  border-radius: 50%;
  transition: all .3s ease-out;
  
  &.active {
    background: #fff;
  }
}
              
            
!

JS

              
                

const $button = document.getElementById('button');
const $headings = document.querySelectorAll('h3');
const $subheadings = document.querySelectorAll('h5');
const $dots = document.querySelectorAll('.dot');

let currentStep = 1;
const steps = 5;

$button.addEventListener('mousedown', () => {
  $button.classList.add('pressed');
});

$button.addEventListener('mouseup', () => {
  $button.classList.remove('pressed');
  updateStep(currentStep)
});

function updateStep(n) {
  
  
  const prevN = n > 0 ? n-1 : 0;
  
   if(n > 0) {
    $headings[n - 1].classList.remove('active');
    $subheadings[n - 1].classList.remove('active');
    $dots[n - 1].classList.remove('active');
  }
  
  if(n === 0) {
    $headings[4].classList.remove('active');
    $subheadings[4].classList.remove('active');
    $dots[4].classList.remove('active');
  }
  
  $headings[n].classList.add('active');
  $subheadings[n].classList.add('active');
  $dots[n].classList.add('active');
  
   console.log('currentStep',currentStep)
  
  
  currentStep < 4 ? currentStep++ : currentStep = 0;
}
 

              
            
!
999px

Console