<section class="viewport" id="content">
<div class="cube rotate1 " id="test">
<div class="front" id="ajax-container"></div>
<div class="back"></div>
<div class="right"></div>
<div class="left"></div>
<div class="top"></div>
<div class="bottom"></div>
</div>
</section>
<button type="button" class="test">Click Me!</button>
jQuery:
$(".test").on('click',function(e){
$(".cube").addClass('paused');
});
How can i get the current position of the cube when i pause the animation?
I need its current position(rotatex,rotatey) in jQuery to do stuff from that position.
UPDATED:
i have tried this script :
function getRotationDegrees(obj) {
var matrix = obj.css("-webkit-transform") ||
obj.css("-moz-transform") ||
obj.css("-ms-transform") ||
obj.css("-o-transform") ||
obj.css("transform");
if(matrix !== 'none') {
var values = matrix.split('(')[1].split(')')[0].split(',');
var a = values[0];
var b = values[1];
var angle = Math.round(Math.atan2(b, a) * (180/Math.PI));
} else { var angle = 0; }
return (angle < 0) ? angle + 360 : angle;
}
but i get numbers under 180 degrees. It is not working properly.