Skip to content

Instantly share code, notes, and snippets.

@dalmaer
Created December 13, 2011 03:54
Show Gist options
  • Save dalmaer/1470483 to your computer and use it in GitHub Desktop.
Save dalmaer/1470483 to your computer and use it in GitHub Desktop.
$(document).ready(function() {
$(document).mousemove(function(e) {
var horizontal = e.pageX / $(document).width();
var vertical = e.pageY / $(document).height();
$('.ipad').css({
'-webkit-transform': 'rotateX(' + (7 - (vertical * 14)) + 'deg) rotateY(' + ( - 10 + (horizontal * 20)) + 'deg)'
});
$('.specular').css({
'background-position': ( - 200 + (horizontal * -500)) + 'px ' + ( - vertical * 600) + 'px',
'opacity': 1 - (horizontal * .45) - (vertical * .45)
});
$('.home-btn').css({
'background': '-webkit-linear-gradient(-' + (80 - horizontal * 20) + 'deg, transparent 50%, rgba(255, 255, 255, .05) 50.1%, rgba(255, 255, 255, ' + (.4 - (horizontal * .1) - (vertical * .1)) + '))'
});
$('.ipad.white .home-btn').css({
'background': '-webkit-linear-gradient(-' + (80 - horizontal * 20) + 'deg, rgba(0, 0, 0, ' + (.05 + (horizontal * .05) + (vertical * .05)) + '), rgba(0, 0, 0, 0) 50%, transparent 50.1%)',
'-webkit-box-shadow': '0 0 1px rgba(0, 0, 0, .1)'
});
$('.shadow').css({
'-webkit-transform': 'rotateX(' + (65 + (vertical * 20)) + 'deg) rotateY(' + (10 - (horizontal * 20)) + 'deg) skewX(-15deg)'
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment