Moshe Shaham
Moshe Shaham

Reputation: 15984

3d transform in html 5 canvas

In html5 canvas, is it possible to take a regular 2d image and rotate it backwards so that it will create the effect of 3d surface?

I mean something very simple, just to change the angle of the perspective. Of course, I don't mean to really have a 3d surface

Upvotes: 6

Views: 11672

Answers (1)

ellisbben
ellisbben

Reputation: 6371

I assume that you are not talking about WebGL here soooo...

For 2D canvas graphics, you should try playing with the canvas transform methods. Although there is no way to get a true perspective transform out of them, you can use shearing (the b and c components of the transform matrix). See Wikipedia to get an idea of what you can do with a shear transform and

See a (stupid) JSFiddle example too!

Upvotes: 6

Related Questions