Timer

<div class="component" aria-hidden="true" webc:root="override">
    <div class="timer-wrapper">
        <svg class="timer" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentcolor" viewBox="0 0 256 256">
            <rect width="256" height="256" fill="none"></rect>
            <circle cx="128" cy="128" r="88" fill="var(--theme-color-light)"></circle>
            <circle cx="128" cy="128" r="88" fill="none" stroke="currentcolor" stroke-miterlimit="10" stroke-width="16"></circle>
            <line class="timer-hand" x1="128" y1="128" x2="167.6" y2="88.4" fill="none" stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></line>
            <line class="timer-switch" x1="104" y1="8" x2="152" y2="8" fill="none" stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></line>
        </svg>
    </div>
    <div class="caption"></div>
</div>
<div class="component" aria-hidden="true" webc:root="override">
  <div class="timer-wrapper">
    <svg class="timer" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentcolor" viewBox="0 0 256 256">
      <rect width="256" height="256" fill="none"></rect>
      <circle cx="128" cy="128" r="88" fill="var(--theme-color-light)"></circle>
      <circle cx="128" cy="128" r="88" fill="none" stroke="currentcolor" stroke-miterlimit="10" stroke-width="16"></circle>
      <line class="timer-hand" x1="128" y1="128" x2="167.6" y2="88.4" fill="none" stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></line>
      <line class="timer-switch" x1="104" y1="8" x2="152" y2="8" fill="none" stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></line>
    </svg>
  </div>
  <div class="caption"></div>
</div>
/* No context defined. */
  • Content:
    @use '../../../assets/sass/settings/v7/colors.tokens' as *;
    @use '../../../assets/sass/settings/v7/layout-standard' as *;
    @use '../../../assets/sass/settings/v7/global' as *;
    @use '../../../assets/sass/settings/v7/spacing.tokens' as *;
    @use '../../../assets/sass/tools/v7/mq' as *;
    @use '../../../assets/sass/tools/v7/zindex' as *;
    @use '../../../assets/sass/tools/v7/typography' as *;
    
    
    @property --progress {
      syntax: "<integer>";
      initial-value: 0;
      inherits: false;
    }
    
    .component {
      --size: 12vmin;
      display: grid;
      grid-template-areas:
        "timer"
        "caption";
      place-items: center;
      place-content: center;
      gap: 0.2em;
      position: sticky;
      right: 0;
      bottom: 0;
      width: fit-content;
      @include z(cover);
      @include bp(md){
        --size: 8vmin;
      }
    }
    
    .timer-wrapper {
      grid-area: timer;
      display: grid;
      place-items: center;
      place-content: center;
      grid-template-areas: "container";
      width: var(--size);
      height: var(--size);
      border-radius: 50%;
      background: conic-gradient(
        from 45deg,
        var(--theme-color-lighter) calc(var(--progress) * 1%),
        transparent 0
      );
    }
    
    .timer-wrapper > * {
      grid-area: container;
      filter: drop-shadow(2px 4px 6px var(--background-color-negative));
    }
    
    .timer {
      width: calc(var(--size) / 1.2);
      height: calc(var(--size) / 1.2);
    }
    
    .caption {
      grid-area: caption;
    }
    
    .caption::before,
    .caption::after {
      margin-inline: auto;
      content: counter(progress);
      font-size: calc(0.6em + var(--size) / 6);
      font-weight: bold;
      text-align: center;
      font-variant-numeric: tabular-nums;
    }
    
    .caption::after {
      content: "%";
    }
    
    
    @supports (animation-timeline: scroll()) {
    
      :is(.component, .timer-wrapper, .timer, .timer-hand, .timer-switch) {
        animation-timeline: view();
        // animation-range: entry 0% exit 10%;
      }
    
      .component {
        --plunge-offset: 10rem;
        --plunge-start: calc(100% - var(--plunge-offset) * 2);
        --plunge-end: calc(100% - var(--plunge-offset));
    
        animation-name: progress;
        //animation-range: 0 var(--plunge-start);
        counter-reset: progress var(--progress);
    
    
        
      }
    
      .timer-wrapper {
        animation-name: progress, turn-upright;
        //animation-range: 0 var(--plunge-start),var(--plunge-start) var(--plunge-end);
      }
    
      .timer {
        --plunge-depth: 0.25em;
        transform-origin: 50% 0;
        animation-name: plunge;
        //animation-range: var(--plunge-start) var(--plunge-end);
      }
    
      .timer-switch {
        --plunge-depth: 1em;
        transform-origin: 50% 0;
        animation-name: plunge;
        //animation-range: var(--plunge-start) var(--plunge-end);
      }
    
      .timer-hand {
        transform-origin: 50%;
        rotate: calc((var(--progress) / 100) * 360deg);
        animation-name: progress;
        //animation-range: 0 var(--plunge-start);
      }
    
      @keyframes progress {
        to {
          --progress: 100;
        }
      }
    
      @keyframes turn-upright {
        from {
          rotate: -10deg;
        }
        to {
          rotate: 0;
        }
      }
    
      @keyframes plunge {
        50% {
          translate: 0 var(--plunge-depth);
        }
      }
    
      @keyframes fade-out {
        from {
          opacity: 1;
        }
        to {
          opacity: 0;
        }
      }
    }
    
    
    
  • URL: /components/raw/timer/_timer.scss
  • Filesystem Path: src/lib/components/timer/_timer.scss
  • Size: 3.1 KB

No notes defined.