How to do perspective view with html5 canvas

后端 未结 2 1217
傲寒
傲寒 2021-01-12 08:26

I would like to make an image into skewed/perspective/rotated in html5 canvas. The image below is exactly what I would want to do.

2条回答
  •  死守一世寂寞
    2021-01-12 09:17

    Unfortunately it isn't possible to use the canvas context setTransform method to perform perspective transformations (you are limited to translate, scale, rotate and skew).

    However, depending on your use-case, you may be able to fake it:

    http://tulrich.com/geekstuff/canvas/perspective.html http://yuiblog.com/blog/2008/06/23/slicing/

提交回复
热议问题