title: Rotation and perspective transform in Android (CATransform3DRotate in Swift)
body: <p>Since I have been spending my last few days trying to get this swift code translated into Kotlin for an university app I figured I might need help.</p>
  <pre><code>var rotationAndPerspectiveTransform = CATransform3DIdentity
  rotationAndPerspectiveTransform.m34 = 1 / -100
  rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, 45.0 * .pi / 180.0, 1.0, 0.0, 0.0)
  self.layer.anchorPoint = CGPoint(x: 0.5, y: 0.5)
  self.layer.transform = rotationAndPerspectiveTransform
  </code></pre>
  <p>I need to transform a canvas inside a custom view:</p>
  <pre><code>override fun draw(canvas: Canvas?) {
          super.draw(canvas)
  
          canvas?.let {
  
              val matrix = Matrix()
              val camera = Camera()
              
              // Transform ...
  
              it.drawPath(path(-150F), paint())
              it.drawPath(path(150F), paint())
          }
  
      }
  </code></pre>
  <p>What I am understanding is:</p>
  <ul>
  <li>.m34 is a 4v4 index matrix with -0.01 at 3/4</li>
  <li>this matrix then gets rotated by 45 deg on the x axis: <code>t' = rotation(angle, x, y, z) * t.</code></li>
  <li>then the anchor point is set to the center (0.5/ 0.5)</li>
  <li>finally the rotation is applied to the layer</li>
  </ul>
  <p>What I am not understanding is:</p>
  <ul>
  <li>how to translate those steps into Kotlin</li>
  </ul>