Rotation with Pixastic

I have a canvas element with an image in.

Now I try to rotate the image in the canvas when I click the button:

$("#rotateC").live('click',function(e) { e.preventDefault(); console.log("rotateC"); Pixastic.process(firstImg, 'rotate', { 'angle': +90, 'leaveDOM': true }, function(firstImg) { ctx.drawImage(firstImg, 0, 0); } ); }); 

The image will rotate once, and then if I press the button again, nothing will happen.

Do you know what the problem is?

+4
source share
1 answer

You can see how to rotate with pixastic jquery and its demo to solve your problem in jquery! (hope this is ok for you)

 $(function(){ $('#rotate').live('click',function() { $("#img1").pixastic("rotate", {angle:90}); }); }); 

should work if your button has rotate id and your image id img1

+2
source

Source: https://habr.com/ru/post/1403923/


All Articles