Skip to content

Instantly share code, notes, and snippets.

@roundrobin
Created January 15, 2013 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roundrobin/4540614 to your computer and use it in GitHub Desktop.
Save roundrobin/4540614 to your computer and use it in GitHub Desktop.
Text Shadow
{"description":"Text Shadow","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"tab":"edit","display_percent":0.7,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"hidepanel":false,"fullscreen":false,"thumbnail":"http://i.imgur.com/2k609mq.png"}
var svg = d3.select("svg");
var text = svg.append('text')
.attr('x',200)
.attr('font-size',100)
text.append('tspan')
.text('H')
.attr('y',200)
.style('text-shadow','0px 0px 0px #FF00FF');
text.append('tspan')
.text('E')
.attr('y',200)
.style('text-shadow','0px 0px 0px #FF00FF');
text.append('tspan')
.text('L')
.attr('y',200)
.style('text-shadow','0px 0px 0px #FF00FF');
text.append('tspan')
.text('L')
.attr('y',200)
.style('text-shadow','0px 0px 0px #FF00FF');
text.append('tspan')
.text('O')
.attr('y',200)
.style('text-shadow','0px 0px 0px #FF00FF');
svg.selectAll('tspan').each(function(d,i){
var elem = d3.select(this);
elem
.style('text-shadow','0px 0px 0px #FF00FF')
.transition()
.duration(500)
.delay(45*i)
.style('text-shadow','4px 4px 2px #BE29BE')
.attr('fill','#F0F0F0')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment