4

I have a canvas element with an image into.

Now I try to rotate the image in the canvas when I click a 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 click the button again, nothing happens.

Do you know what the problem is?

Brydeboel
  • 43
  • 3

1 Answers1

2

You can look at How to rotate with pixastic jquery and his demo to solve your problem in jquery! (hope that is okay for you)

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

should be working if your button has the id rotate and your image the id img1

Community
  • 1
  • 1
Neysor
  • 3,893
  • 11
  • 34
  • 66