0

I have tried the "Getting Started" tutorial on the Snap.svg website and also attempted duplicating the code found here http://codepen.io/rachsmith/pen/FzAGt

But I just can't seem to get the SVG masking to work.

Have other people had this issue? As far as I can tell the only difference between the way I set it up and the tutorials online is my use of the AngularJS framework.

Rob Watt
  • 29
  • 2

1 Answers1

2

At a basic level it seems to work.

angular.module('myApp', []).directive('mySvg', function() {
    return {
        restrict: 'E',
        link: function(scope, element, attr) {
            var s = Snap(120, 120);
            element.append(s.node);   
            var first = s.circle(40, 60, 40).attr({
                fill: "#888"
            });
            var second = s.circle(80, 60, 40).attr({
                fill: "#fff"
            });
            first.attr({
                mask: second
            });
        }
    };
});

See the code on fiddle. http://jsfiddle.net/83Gd4/1/