Reputation: 63
In an Android app I have an object that is created through a custom view. It basically has a rectangular shape. I want to apply a 3D transformation that makes it look like this:
In the draw()
function I have tried various things like this:
override fun draw(canvas: Canvas?) {
super.draw(canvas)
val matrix = Matrix()
var pivX = myWidth / 2.0f
var pivY = myHeight /1.0f
matrix.setSkew(1f, 0f, pivX, pivY);
canvas?.withMatrix(matrix) {
drawPath(path(-150F), paint())
drawPath(path(150F), paint())
}
}
I couldn't make it work though. Where's my mistake? What am I missing?
Upvotes: 1
Views: 302