T
T
toly192017-04-20 12:44:28
JavaScript
toly19, 2017-04-20 12:44:28

How to use an image multiple times in svg.js?

There is an image in base64 string.
I need to use this image a lot of times (background).

//pattern == data:image/png;base64, ...
var svgEnd = SVG("data").fill("white");
var svgPattern = svgEnd.image(pattern);

After that, 2 is loaded !!! copies of the image (I don't know why, but if you specify the url as the image, it is loaded 1 time)
da71440dc7c1497b878af3ba5de0b21d.PNG
if you use "svgEnd.image(pattern)" again, +2 more copies will be created.
How can I use this image multiple times without recreating it in svgjs?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Deniskin Rediskin, 2017-05-09
@DenVdmj

The <use> element
https://developer.mozilla.org/en/docs/Web/SVG/Elem...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question