[code]
getRotationDegrees() {
// get the computed style object for the element
const style = window.getComputedStyle(this.$refs.needle)
// this string will be in the form ‘matrix(a, b, c, d, tx, ty)’
const transformString =
style[‘-webkit-transform’] || style[‘-moz-transform’] || style.transform
if (!transformString || transformString === ‘none’) return 0
const splits = transformString.split(‘,’)
// parse the string to get a and b
const parenLoc = splits[0].indexOf(‘(‘)
const a = parseFloat(splits[0].substr(parenLoc + 1))
const b = parseFloat(splits[1])
// doing atan2 on b, a will give you the angle in radians
const rad = Math.atan2(b, a)
let deg = (180 * rad) / Math.PI
// instead of having values from -180 to 180, get 0 to 360
if (deg < 0) deg += 360
return deg
}
[/code]
https://stackoverflow.com/questions/3336101/css3-animation-on-transform-rotate-way-to-fetch-current-deg-of-the-rotating-el