<div class="timer">
  <div class="timer__progress"></div>
  <p class="timer__text">Текст</p>
</div>
body {
  min-height: 100vh;
  margin: 0;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
}

.timer {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
  
  &__progress {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
  }
  
  &__text {
    margin: 0;
    font-size: 2.5em;
    text-transform: uppercase;
    opacity: 0.75;
    z-index: 1;
  }
}
View Compiled
const timer = document.querySelector('.timer');

const canvas = document.createElement('canvas');
const context = canvas.getContext('2d');

const duration = 12000;
const halfPI = Math.PI / 2;
let startTime = 0;
let radius = 0;

const now = () => performance.now();

const draw = (progress) => {
  const x = canvas.width / 2;
  const y = canvas.height / 2;

  context.clearRect(0, 0, canvas.width, canvas.height);
  context.beginPath();
  context.moveTo(x, y);
  context.arc(x, y, radius, -halfPI, Math.PI * 2 * progress - halfPI);
  context.closePath();
  context.fillStyle = '#8cd2a2';
  context.fill();
};

const update = () => {
  const delta = now() - startTime;
  const difference = duration - delta;
  const percent = Math.max(0, Math.min(1, difference / duration));
  
  draw(percent);  
  
  if (difference > 0) {
    requestAnimationFrame(update);
  }
};

const start = () => {
  startTime = now();
  requestAnimationFrame(update);
};

const init = () => {
  const progress = timer.querySelector('.timer__progress');
  const progressBox = progress.getBoundingClientRect();
  
  [canvas.width, canvas.height] = [progressBox.width, progressBox.height];
  radius = Math.min(canvas.width, canvas.height) / 2;
  
  draw(1);
  progress.append(canvas);
};

window.addEventListener('DOMContentLoaded', init);
window.addEventListener('click', start);

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.