<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="800" width="800">
<defs>
<linearGradient id="Gradient1" gradientTransform="rotate(90)">
<stop offset="0%" stop-color="#000000"/>
<stop offset="10%" stop-color="#000000"/>
<stop offset="50%" stop-color="#8b9643"/>
<stop offset="90%" stop-color="#000000"/>
<stop offset="100%" stop-color="#000000"/>
</linearGradient>
<linearGradient id="Gradient2" gradientTransform="rotate(90)">
<stop offset="10%" stop-color="#000000"/>
<stop offset="0%" stop-color="#000000"/>
<stop offset="50%" stop-color="#dda885"/>
<stop offset="90%" stop-color="#000000"/>
<stop offset="100%" stop-color="#000000"/>
</linearGradient>
<pattern id="Pattern" x="0" y="0" width="600" height="600" patternUnits="userSpaceOnUse">
<g transform="rotate(0, 300, 300)">
<rect shape-rendering="crispEdges" x="0" y="0" width="300" height="600" fill="url(#Gradient1)"/>
<rect shape-rendering="crispEdges" x="300" y="0" width="300" height="600" fill="url(#Gradient2)"/>
</g>
</pattern>
</defs>
<path id='arc5' class="animated"
style="stroke: url(#Pattern);" fill='transparent'
stroke-dasharray="1570 1570"
stroke-dashoffset="0"
stroke-width='100'
d='M 300 58 A 250 250 0 1 1 299.99 58'/>
</svg>
this is my donut shape figure. How can I animate this donut to appear from top to bottom symmetrically using css? The donut’s left half and right half should appear at the same time.
2
Answers
this is a simple way to animate it using CSS and HTML. The principle is to use a mask and shrink it to reveal the donut. Hope this helps:
You can animate a stroke-dasharray in a mask. I use a circle because and set the pathLength so that it’s easier to calculate the array.