I have the SVG circle chart which has a gradient stroke. My problem is that I can not figure out how to do the gradient invisible from the start with opacity 0 and make it opacity 1 at the end. What do I need to get is at the image bellow.
What do I have until now is in my snippet bellow
/*graf animacie*/
.circle-chart__circle {
animation: circle-chart-fill 2s reverse; /* 1 */
transform: rotate(-90deg); /* 2, 3 */
transform-origin: center; /* 4 */
}
.circle-chart__circle--negative {
transform: rotate(-90deg) scale(1,-1); /* 1, 2, 3 */
}
.circle-chart__info {
animation: circle-chart-appear 2s forwards;
opacity: 0;
transform: translateY(0.3em);
}
@keyframes circle-chart-fill {
to { stroke-dasharray: 0 100; }
}
@keyframes circle-chart-appear {
to {
opacity: 1;
transform: translateY(0);
}
}
.grid {
display: grid;
grid-column-gap: 1em;
grid-row-gap: 1em;
grid-template-columns: repeat(1, 1fr);
}
@media (min-width: 31em) {
.grid {
grid-template-columns: repeat(2, 1fr);
}
}
<div style="margin: auto; display: contents; text-align: center;">
<section>
<svg class="circle-chart" viewbox="0 0 33.83098862 33.83098862" width="150" height="200" xmlns="http://www.w3.org/2000/svg">
<circle class="circle-chart__background" stroke="#efefef" stroke-width="2" fill="none" cx="16.91549431" cy="16.91549431" r="15.91549431" />
<circle class="circle-chart__background" stroke="white" stroke-width="2" fill="none" cx="16.91549431" cy="16.91549431" r="15.91549431" />
<circle class="circle-chart__circle circle-chart__circle--negative" stroke="url(#gradient)" stroke-width="2" stroke-dasharray="90,100" stroke-linecap="" fill="none" cx="16.91549431" cy="16.91549431" r="15.91549431" />
<g class="circle-chart__info">
<text class="circle-chart__percent" x="16.91549431" y="15.5" alignment-baseline="central" text-anchor="middle" font-size="8">DEMO</text>
</g>
<defs>
<linearGradient id="gradient" x1="1" y1="1" x2="0" y2="0">
<stop offset="0.01" stop-color="#fdfafa"></stop>
<stop offset="0.20" style="stop-color:#e5b4b6"/>
<stop offset="0.80" style="stop-color:#c2545a"/>
<stop offset="1" stop-color="#AE1515"></stop>
</linearGradient>
</defs>
</svg>
</section>
</div>
Thanks in advance for your help.