[ Launch: drag ] 6165060 by jandot
-
-
Save jandot/6165060 to your computer and use it in GitHub Desktop.
drag
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":"drag","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"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/mewvbZf.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
var svg = d3.select("svg"); | |
var drag = d3.behavior.drag() | |
.on("drag", function() { | |
var dx = d3.event.dx; | |
var dy = d3.event.dy; | |
console.log(dx, dy); | |
}) | |
var rect = svg.append("rect") | |
.attr({ | |
width: 400, | |
height: 400, | |
fill: "#ff0000" | |
}) | |
rect.call(drag); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment