To achieve a similar effect, you want to try texture mapping, and you need some 2d-3d units and math skills. Basically the idea is to split the texture in triangles and match them to the 2d coordinate using the transformation matrix. At first itβs easier to start with rectangles and then use my curved shape, but I am also new to this, so I donβt know if texture matching is really used for the image curve. Here is an example of a simple texture mapping: Image processing and texture mapping using an HTML5 canvas .
In the above link there is this subfunction:
n the following code I assume you have a picture object texture and 4 corners each of which is an object with fields x,y,u,v where x,y are pixel coordinates on the target canvas and u,v are pixel coordinates on texture:
IMO is enough information to start texture mapping.
source share