Reputation: 859
Failing to create an image pattern for a path element through Snap.svg library. Is it possible?
Creating a Paper.image()
and then trying to call Element.pattern()
on it doesn't seem to be an option or a working solution.
So i wonder whether it's possible to do so using Snap.svg lib. or Should i generate the needed , elements myself and then append them to the needed svg 'by hands'?
Thanks in advance!
Upvotes: 1
Views: 2376
Reputation: 5359
Do you mean like this?
var paper = Snap(200,200);
var pattern = paper.image("logo.svg",0,0,50,50)
.pattern(0,0,50,50);
var path = paper.path("M0,0h200v200h-200z").attr("fill", pattern);
Upvotes: 4