Created
May 18, 2016 14:09
-
-
Save diederikh/d657272f17e523b0edbc09fcdbee5618 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIView { | |
func xscale() -> CGFloat { | |
let t = self.transform | |
return sqrt(t.a * t.a + t.c * t.c) | |
} | |
func yscale() -> CGFloat { | |
let t = self.transform | |
return sqrt(t.b * t.b + t.d * t.d); | |
} | |
func rotation() -> CGFloat { | |
let t = self.transform | |
return CGFloat(atan2f(Float(t.b), Float(t.a))); | |
} | |
func tx() -> CGFloat { | |
let t = self.transform | |
return t.tx; | |
} | |
func ty() -> CGFloat { | |
let t = self.transform | |
return t.ty; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment