Created
May 13, 2014 09:51
-
-
Save anonymous/6a7e7daac02de48c1d9d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
<script src="http://snapsvg.io/assets/js/snap.svg-min.js"></script> | |
<script src="http://snapsvg.io/assets/js/prism.js"></script> | |
</head> | |
<body> | |
<div id="svg" width="400" height="400"></div> | |
</body> | |
</html> |
This file contains hidden or 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 s = Snap(400,400); | |
var bigCircle = s.circle(150, 150, 100); | |
var moveFunc = function (dx, dy, posx, posy) { | |
this.attr( { cx: posx , cy: posy } ); | |
}; | |
bigCircle.drag( moveFunc, | |
function(){ | |
this.attr({fill:'red'}); | |
console.log("Move started"); | |
}, | |
function(){ | |
this.attr({fill:'black'}); console.log("Move stopped"); | |
} | |
); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment