Skip to content

Instantly share code, notes, and snippets.

Created May 13, 2014 09:51
Show Gist options
  • Save anonymous/6a7e7daac02de48c1d9d to your computer and use it in GitHub Desktop.
Save anonymous/6a7e7daac02de48c1d9d to your computer and use it in GitHub Desktop.
<!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>
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