Last active
August 29, 2015 14:13
-
-
Save giuliandrimba/768fa749bbe90b150941 to your computer and use it in GitHub Desktop.
odom
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
module.exports = function(jObj) { | |
var obj; | |
obj = { | |
_y: 1000, | |
_x: 1000, | |
_opacity: 0, | |
dom: jObj | |
}; | |
Object.defineProperty(obj, "y", { | |
get: function() { | |
return obj._y; | |
}, | |
set: function(val) { | |
obj._y = val; | |
return obj.dom.css({ | |
"transform": "translate3d(0, " + obj._y + "%, 0)" | |
}); | |
} | |
}); | |
Object.defineProperty(obj, "x", { | |
get: function() { | |
return obj._x; | |
}, | |
set: function(val) { | |
obj._x = val; | |
return obj.dom.css({ | |
"transform": "translate3d(" + obj._x + "%, 0, 0)" | |
}); | |
} | |
}); | |
Object.defineProperty(obj, "opacity", { | |
get: function() { | |
return obj._opacity; | |
}, | |
set: function(val) { | |
return obj.dom.css("opacity", obj._opacity); | |
} | |
}); | |
return obj; | |
}; |
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
module.exports = (jObj)-> | |
obj = | |
_y: 1000 | |
_x: 1000 | |
_opacity: 0 | |
dom: jObj | |
Object.defineProperty obj, "y", | |
get:-> obj._y | |
set:(val)-> | |
obj._y = val | |
obj.dom.css | |
"transform": "translate3d(0, #{obj._y}%, 0)" | |
Object.defineProperty obj, "x", | |
get:-> obj._x | |
set:(val)-> | |
obj._x = val | |
obj.dom.css | |
"transform": "translate3d(#{obj._x}%, 0, 0)" | |
Object.defineProperty obj, "opacity", | |
get:-> obj._opacity | |
set:(val)-> | |
obj.dom.css "opacity", obj._opacity | |
obj |
Author
giuliandrimba
commented
Jan 12, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment