marcuscalidus-svg-panel icon indicating copy to clipboard operation
marcuscalidus-svg-panel copied to clipboard

.image question

Open yosiasz opened this issue 2 years ago • 2 comments

Greetings,

This is a lovely plugin!

What is the location of the image referenced below?

const arrow = s.image("apple.png", 10, 10, 150, 150);

And can I use my own image?

Thanks!

yosiasz avatar Jul 24 '22 02:07 yosiasz

ok, I think I now understand. I either need to use a url

const url = 'http://openweathermap.org/img/wn/[email protected]'

or this part of the docu says

To add your own custom SVG graphics you have to fork the original project and add them to the assets folder.

Thanks!

yosiasz avatar Jul 24 '22 04:07 yosiasz

interesting you can even refer to a file on disk

const img = '/public/img/wind-direction-arrow.svg'
drawArrow();


function drawArrow() {
    //10,10,150,150
    //"apple.png", 10, 10, 80, 80
    const arrow = s.image(img,140,10,40,40);
    arrow.attr({fill: "blue", transform: "rotate(45)"});
    
    const arrow2 = s.image(img,50,10,40,40);
    arrow2.attr({stroke:"blue", fill:"purple", transform: "rotate(-13)"});
    
    const arrow3 = s.image(img,205,7,40,40);
    arrow3.attr({stroke:"blue", fill:"purple", transform: "rotate(45)"});
    
}

yosiasz avatar Jul 24 '22 18:07 yosiasz