A very simple JS Plugin for making element rotate and translate relative to the cursor movement.
Include the rotr.js in head or before ending body tag.
<script type="text/javascript" src="rotr.js"></script>
To apply it on a elment , create the Rotr Object passing the element and options to it.
<script>
text = new Rotr("#text",{
xInverse: true, // set to true if you want to move the element opposite to cursor movement in X-Axis
yInverse: false, // set to true if you want to move the element opposite to cursor movement in Y-Axis
speed : 0.09, // set speed of relative movement
translate : true, // set to false if you dont want to translate the element
rotate : false, // set to false if you dont want to rotate the element
vertical : true, // restrict the movement in X-axis only
horizontal : true // restrict the movement in Y-axis only
});
</script>
Here are the default values
var defaults = {
xInverse: false,
yInverse: false,
speed : 0.09,
translate : true,
rotate : true,
vertical : true,
horizontal : true
};