0

I want to create a simple script that rotates a DIV in 3D perspective, so I want to gradually manipulate div's transform property. It's initially set to perspective(500px) rotateY(44deg), but when I try to get the property value with jQuery's .css(), it only returns the matrix3d property, leaving me with no direct access to rotateY(). How can I easily access and adjust transform's attributes such as rotateY() with js/jQuery?

Kuba Orlik
  • 3,360
  • 6
  • 34
  • 49
  • Ideally you shouldn't be writing something that needs to keep reading from the CSS. Why not keep track of your values in the JS and only write to the properties? – freejosh Nov 21 '12 at 21:18
  • I think it would be hard as I'm aiming to animate dynamically loaded elements... Anyway the main hurdle for me is the lack of direct access to very specific properties of the transform, such as "rotateY()" – Kuba Orlik Nov 21 '12 at 21:36
  • 2
    In that case I think you're going to have to do some math with the matrix. [Here's a similar question with an answer](http://stackoverflow.com/questions/8270612/get-element-moz-transformrotate-value-in-jquery). – freejosh Nov 21 '12 at 21:48
  • 1
    Have you looked at any of the available jQuery 3D transform plugins? Related: [Are JS-animated transforms still hardware-accelerated?](http://stackoverflow.com/q/8783973/1048572) – Bergi Nov 22 '12 at 01:44

0 Answers0