Skip to content

Instantly share code, notes, and snippets.

@willbailey
Created November 6, 2014 02:29
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 willbailey/291d75841084b5806a89 to your computer and use it in GitHub Desktop.
Save willbailey/291d75841084b5806a89 to your computer and use it in GitHub Desktop.
var xfrm = function(el, xlatX, xlatY, scale, rot) {
xlatX = typeof xlatX === 'undefined' ? 0 : xlatX;
xlatY = typeof xlatY === 'undefined' ? 0 : xlatY;
scale = typeof scale === 'undefined' ? 1 : scale;
rot = typeof rot === 'undefined' ? 0 : rot;
var xfrm =
'translate3d(' + xlatX + 'px, ' + xlatY + 'px, 0px) ' +
'scale3d(' + scale + ', ' + scale + ', 1) ' +
'rotate(' + rot + 'deg)';
el.style.mozTransform =
el.style.msTransform =
el.style.webkitTransform =
el.style.transform = xfrm;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment