C
C
Cheizer2020-11-12 18:03:37
HTML
Cheizer, 2020-11-12 18:03:37

How to insert an image into an animated SVG?

Please tell me, I generated a loader on the service, and I want to insert a logo into it in the center, inside a circle with animation, how can I do this?

<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin: auto; background: none; display: block; shape-rendering: auto;" width="200px" height="200px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
<circle cx="50" cy="50" r="32" stroke-width="3" stroke="#2d59b2" stroke-dasharray="50.26548245743669 50.26548245743669" fill="none" stroke-linecap="round">
  <animateTransform attributeName="transform" type="rotate" repeatCount="indefinite" dur="1s" keyTimes="0;1" values="0 50 50;360 50 50"></animateTransform>
</circle>


Here it is a circle, I want to insert a static logo inside it.
https://codepen.io/Cheizer/pen/NWrewJb

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
twolegs, 2020-11-12
@Cheizer

Image tag, positioned at coordinates (svgWidth - imgWidth) / 2, similar for height

https://codepen.io/two-legs/pen/OJXrzbW

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question