Skip to content

Instantly share code, notes, and snippets.

@poezn
Forked from roundrobin/_.md
Created January 17, 2013 22:51
Show Gist options
  • Save poezn/4560616 to your computer and use it in GitHub Desktop.
Save poezn/4560616 to your computer and use it in GitHub Desktop.
Toggle Switch
{"description":"Toggle Switch","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}},"tab":"edit","display_percent":0.3708333333333332,"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}
var svg = d3.select("svg");
var defs = g.append('svg:defs');
//This create an ellipsis shape for the drop shadow texure
defs.append('svg:path')
.attr("id","ellipsis")
.attr("d","M25.323,44.2c-11.529,0-20.871-1.29-20.871-2.87s9.342-2.87,20.871-2.87c11.521,0,20.862,1.29,20.862,2.87 S36.844,44.2,25.323,44.2");
//Creates a clippath for the drop shadow of the ball
var clipPath = g.append('svg:clipPath')
.attr("id","clippy1");
clipPath.append("use")
.attr("xlink:href","#ellipsis")
.attr("overflow","visible");
//Create a group for the icon we are about to add to the canvas
var group = g.append("svg:g")
.attr("transform","matrix(1 0 0 1 -2.384186e-07 0)")
.attr("class","group")
.attr("clip-path","url(#clippy1)");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment