Created
November 13, 2014 12:02
-
-
Save elrrrrrrr/a9209a66b43dace5b408 to your computer and use it in GitHub Desktop.
SVG-circle-image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var circle = paper.circle(size/4, size/4, 40); | |
var uuid = Raphael.createUUID(); | |
var pattern = document.createElementNS("http://www.w3.org/2000/svg", "pattern"); | |
var backgroundImage = paper.image("../css/tx.png", 0, 0, 1, 1); | |
pattern.setAttribute("id", uuid); | |
pattern.setAttribute("x", 0); | |
pattern.setAttribute("y", 0); | |
pattern.setAttribute("height", 1); | |
pattern.setAttribute("width", 1); | |
pattern.setAttribute("patternContentUnits", "objectBoundingBox"); | |
pattern.appendChild(backgroundImage.node); | |
paper.defs.appendChild(pattern); | |
circle.node.setAttribute("fill", "url(#" + pattern.id + ")"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment