You are here

lp-circle-progress.html.twig in Opigno Learning path 3.x

<div class="circle-progress">
  {% set L = 2 * 3.14 * radius %}
  {% set dashOffset = L - (L * progress) / 100 %}
  <svg>
    <circle cx="{{ radius }}" cy="{{ radius }}" r="{{ radius }}"></circle>
    <circle cx="{{ radius }}" cy="{{ radius }}" r="{{ radius }}" stroke-width="10" stroke-dasharray="{{ L }}"
            stroke-dashoffset="{{ dashOffset }}"></circle>
    <text x="37" y="40" text-anchor="middle">{{ progress ~ '%' }}</text>
  </svg>
</div>

File

templates/lp-circle-progress.html.twig
View source
  1. <div class="circle-progress">
  2. {% set L = 2 * 3.14 * radius %}
  3. {% set dashOffset = L - (L * progress) / 100 %}
  4. <svg>
  5. <circle cx="{{ radius }}" cy="{{ radius }}" r="{{ radius }}"></circle>
  6. <circle cx="{{ radius }}" cy="{{ radius }}" r="{{ radius }}" stroke-width="10" stroke-dasharray="{{ L }}"
  7. stroke-dashoffset="{{ dashOffset }}"></circle>
  8. <text x="37" y="40" text-anchor="middle">{{ progress ~ '%' }}</text>
  9. </svg>
  10. </div>