javascript - 使用 Pixastic 旋转

标签 javascript image-manipulation pixastic

我有一个带有图像的 Canvas 元素。

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

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

图像将旋转一次,然后如果我再次单击该按钮,则什么也不会发生。

你知道问题出在哪里吗?

最佳答案

可以看看How to rotate with pixastic jqueryhis demo在 jquery 中解决你的问题! (希望你没问题)

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

如果你的按钮有 id rotate 并且你的图像有 id img1 应该可以工作

关于javascript - 使用 Pixastic 旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9910086/

相关文章:

javascript - 无需按下即可触发 keyup

javascript - React 中未定义的属性 'map'

php - 如何保存经过处理的图像?

javascript - 用于模糊图像的简单 JavaScript 函数

javascript - 使用 jQuery 的正则表达式问题

javascript - firefox 31 javascript 提交不工作

image-processing - RAW 图像文件 - 我的数据是什么格式?

c++ - OpenCV 图像处理

image - 图像的结构如何