4

我有一个带有图像的画布元素。

现在我尝试在单击按钮时旋转画布中的图像:

$("#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);
            }
        );
    });

图像将旋转一次,然后如果我再次单击该按钮,则没有任何反应。

你知道问题是什么吗?

4

1 回答 1

2

您可以查看How to rotate with pixastic jquery他的演示来解决您在 jquery 中的问题!(希望你没问题)

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

rotate如果您的按钮具有 id而您的图像具有 id 应该可以工作img1

于 2012-03-28T19:59:01.267 回答