- // Text on the path
var s = Snap("#svg");
- // Setting the background
var bg = s.rect(50, 50, 200, 200, 10).attr({fill: "#ccc"});
- var t = s.text(150, 150, "Test Text").attr({
font: "30px Helvetica, sans-serif",
textAnchor: "middle",
fill: "#ddd"
});
- // Lets create a mask
- var t2 = t.use().attr({
stroke: "#000",
strokeWidth: 10,
strokeLinecap: "round",
strokeLinejoin: "round"
});
- var mask = s.mask();
- // Background rect:
mask.add(s.rect(0, 0, "100%", "100%").attr({fill: "#fff"}));
- // and our ring
mask.add(t2);
- bg.attr({
mask: mask
});
- //Now, let’s animate:
- t2.animate({strokeWidth: 4}, 5e3, mina.bounce);