Skip to content

Instantly share code, notes, and snippets.

@MattRoelle
Last active August 29, 2015 14:04
Show Gist options
  • Save MattRoelle/83b23b279ad945594f25 to your computer and use it in GitHub Desktop.
Save MattRoelle/83b23b279ad945594f25 to your computer and use it in GitHub Desktop.
jQuery(function($) {
function Demo() {
var i, j;
$('html').css('perspective', '2000px');
$('body').css({'transition': 'transform 0.1s ease-out'});
var mousePos = {};
$(window).mousemove(function(e) {
mousePos.x = e.clientX;
mousePos.y = e.clientY;
});
function update() {
i = mousePos.x;
j = mousePos.y;
$('body').css('transform', 'rotateY(' + i + 'deg) rotateX(' + j + 'deg)');
requestAnimationFrame(update);
}
requestAnimationFrame(update);
}
Demo();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment