How to draw this kind of figure in the work? front end.

Mar.22,2021

Zhang Xinxu-A few lines of SVG to achieve ring loading or countdown effect
Zhang Xinxu-CSS3 realizes omelet loading waiting to turn


A circular progress bar based on SVG and CSS3-30 customers


canvas


<style>
        .control {
            flex: 0 0 30px;
            width: 30px;
            padding: 0 10px;
        }

        .icon-play-mini {
            font-size: 30px;
            color: red;
        }

        .icon-mini {
            font-size: 32px;
            position: absolute;
            font-style: normal;
            left: 33px;
            top: 29px;
        }

        .progress-circle {
            position: relative
        }

        circle {
            stroke-width: 8px;
            transform-origin: center;
        }

        circle.progress-background {
            transform: scale(0.9);
            stroke: yellow;
        }

        circle.progress-bar {
            transform: scale(0.9) rotate(-90deg);
            stroke: green
        }

    </style>
    <script>
      var loadProgress = 0.8
      var dashArray = Math.PI * 100
      var dashOffset = (1 - loadProgress) * dashArray
      document.write(
        '<div class="control">' +
        '<div class="progress-circle">' +
        '        <svg width="100" height="100" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg">' +
        '            <circle class="progress-background" r="50" cx="50" cy="50" fill="transparent"></circle>' +
        '            <circle class="progress-bar" cx="50" cy="50" r="50" fill="transparent" stroke-dashoffset="' + dashOffset + '" stroke-dasharray="' + dashArray + '"></circle>' +
        '        </svg>' +
        '        <i class="icon-play-mini icon-mini" >' + loadProgress * 100 + '</i>' +
        '</div>' +
        '</div>'
      )
    </script>

svg and path


can be implemented with canvas.


canvas

Menu