Skip to content

Instantly share code, notes, and snippets.

Forked from mbostock/.block
Last active February 9, 2016 01:28
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Animated Clipped textPath
license: gpl-3.0
<!DOCTYPE html>
<meta charset="utf-8">
path {
fill: #3182bd;
text {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 24px;
<script src="//"></script>
var arc = d3.svg.arc()
.endAngle(function(t) { return t * 2 * Math.PI / 3; });
var svg ="body").append("svg")
.attr("width", 960)
.attr("height", 500)
.attr("transform", "translate(480,250)");
.attr("id", "text-path")
.attr("d", arc(1));
.attr("id", "path");
.attr("id", "text-clip")
.attr("xlink:href", "#path");
.attr("clip-path", "url(#text-clip)")
.attr("x", 8)
.attr("dy", 28)
.attr("xlink:href", "#text-path")
.text("Hello, curved textPath!");"#path").transition()
.attrTween("d", function() { return arc; });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment