Skip to content

Instantly share code, notes, and snippets.

@PseudoSky
Created November 19, 2015 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PseudoSky/44a94d29e7f448719d5f to your computer and use it in GitHub Desktop.
Save PseudoSky/44a94d29e7f448719d5f to your computer and use it in GitHub Desktop.
CSS Perspective Transformation Example
var rotZ = 0;
var rotZ = 0;
var rotZ = 0;
var persp= 0;
var image = document.getElementById('image');
var funk=function(){
image.style.transform="translateX(-96px) translateY(0px) translateZ(0px) rotateX("+rotX+"deg) rotateY("+rotY+"deg) rotateZ(" +rotZ+"deg)";
rotZ+=.5;
rotX+=.7;
rotY+=1;
persp=(persp%800)+5;
image.style["-webkit-perspective"]= persp;
image.style["-moz-perspective"]= persp+"px";
image.style["-ms-perspective"]= persp;
image.style.perspective= persp;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment