Skip to content

Instantly share code, notes, and snippets.

@MrChebik
Created March 19, 2018 17:49
Show Gist options
  • Save MrChebik/d5b834231e635fae0b706d760b76c432 to your computer and use it in GitHub Desktop.
Save MrChebik/d5b834231e635fae0b706d760b76c432 to your computer and use it in GitHub Desktop.
matrix
$(poster).on("mousemove", function(event) {
if (isPrestaged == 1) {
var x = event.pageX - offsetX;
var y = event.pageY - offsetY;
if (x > half_width) {
out_x = (x / half_width * 5) - 5;
} else {
out_x = -5 + (x / half_width * 5);
}
out_y = 3 - (y / half_height * 3);
TweenLite.to(poster, .5, {
rotationY: out_x,
rotationX: out_y
});
}
});
$(poster).on("mouseleave", function() {
if (isPrestaged == 1) {
TweenLite.to(poster, .5, {
transform: "matrix3d(1, 0, 0, 1, 0, 0)"
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment