[ Launch: Path animation - complex ] 4959206 by roundrobin
[ Launch: SVG Path Element ] 4958914 by roundrobin
[ Launch: SVG Path Element ] 4958860 by roundrobin
[ Launch: Bootstrap Trib ] 4711978 by roundrobin
[ Launch: Tributary inlet ] 4711690 by roundrobin
-
-
Save roundrobin/4959206 to your computer and use it in GitHub Desktop.
Path form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"description":"Path form","endpoint":"","display":"svg","public":true,"require":[{"name":"Helpers","url":"https://raw.github.com/roundrobin/svg-path-generator/master/svg-path-generator.js"}],"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}},"fullscreen":false,"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,"thumbnail":"http://i.imgur.com/TzygwMl.png"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
g.append("circle") | |
.attr({ | |
r: 50, | |
cx: 57, | |
cy: 271, | |
fill: "#FF00FF", | |
id: 'handler1' | |
}) | |
.datum({'output': '1'}); | |
g.append("circle") | |
.attr({ | |
r: 50, | |
cx: 229, | |
cy: 167, | |
fill: "#5CFF00", | |
'id': 'handler2' | |
}) | |
.datum({'output': '2'}) | |
g.append("circle") | |
.attr({ | |
r: 50, | |
cx: 384, | |
cy: 131, | |
fill: "#00EBFF", | |
'id': 'handler3' | |
}) | |
.datum({'output': '3'}) | |
g.append("circle") | |
.attr({ | |
r: 50, | |
cx: 517, | |
cy: 224, | |
fill: "#1F00FF", | |
'id': 'handler4' | |
}) | |
.datum({'output': '4'}); | |
var svg = d3.select('svg').node(); | |
var pt = svg.createSVGPoint(); | |
function cursorPoint(evt){ | |
pt.x = evt.clientX; pt.y = evt.clientY; | |
return pt.matrixTransform(svg.getScreenCTM().inverse()); | |
} | |
var text = g.append('text') | |
.text("Lorem Ipsum") | |
.attr("id","check") | |
.attr({ | |
fill: "#000000", | |
x : 0, | |
y: 39, | |
"font-size": 32, | |
"font-family": "Arial", | |
"text-anchor": "start" | |
}); | |
g.on('mousemove',function(){ | |
var loc = cursorPoint(d3.event); | |
var d = document.elementFromPoint(d3.event.pageX, d3.event.pageY); | |
var el = d3.select(d); | |
if(el.node() && el.node().tagName == "circle"){ | |
console.log(el.datum()); | |
if(text.text().length >= 50){ | |
text.text(" "+ el.datum()["output"]) | |
} else { | |
text.text(text.text() +" "+ el.datum()["output"]) | |
} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment