Created
March 19, 2014 08:52
-
-
Save pixelhijack/9637897 to your computer and use it in GitHub Desktop.
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
/* | |
extending Raphael.js: draggable sets | |
*/ | |
Raphael.st.draggable = function() { | |
var _this = this, | |
lx = 0, | |
ly = 0, | |
ox = 0, | |
oy = 0, | |
move = function(dx, dy){ | |
lx = dx + ox; | |
ly = dy + oy; | |
_this.transform('t' + lx + ',' + ly); | |
}, | |
start = function() { | |
this.animate({opacity: 0.4}, 100, 'ease-out'); | |
}, | |
end = function() { | |
ox = lx; | |
oy = ly; | |
this.animate({opacity: 1}, 200, 'ease-in'); | |
}; | |
this.attr({cursor: "move"}); | |
this.drag(move, start, end); | |
return this; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment