user1305962
user1305962

Reputation:

html 5 canvas text

Can we write on different angles on canvas? If yes, how? I want to write something on a click so need coordinates but when I use context.rotate() it doesn't stay at a fixed position. If I click at the right of screen the text is very close to pointer but if I click on right it moves away. So what's the solution?

Upvotes: 0

Views: 142

Answers (1)

Marc Gagne
Marc Gagne

Reputation: 819

Your answer can be found here: HTML5 Text Canvas rotate in case text width is larger than maximum width allowed

If you look at Simon's sample code http://jsfiddle.net/5UKE3/ you'll see where he saves the context, transforms the canvas then restores the context. This is key to what you are trying to achieve.

More on saving and restoring here: http://html5.litten.com/understanding-save-and-restore-for-the-canvas-context/

Upvotes: 2

Related Questions