If you want to use Matrix3D quickly, here is an example of the values you should use:
var m3d:Matrix3D = new Matrix3D(Vector.<Number>([ 1, 0, 0, 0, 0, 1.15, 0.25, 0.00005, 0, 0, 1, 0, 0, 0, 0, 1 ])); tempBitmap.transform.matrix3D = m3d;
But soon you will notice that this approach distorts the image the way you don't want it. For example, it will compress your image horizontally on one side (as you wish), but the content of the image will be stretched vertically . It is difficult to explain, but as soon as you try the method described above, you will notice how the image is vertically stretched.
The same effect can be obtained using rotationX
in combination with PerspectiveProjection
and scaleY
.
If you need a more elegant solution, both in code and image, try DistortImage . The method there is not straightforward (uses a grid of subimages), but it has excellent results.
source share