有没有机会创建一个我可以调用的函数?
如果我在文档就绪函数中放入以下几行代码,它就能正常工作:
Caman("25-02-2014_16-37-13.jpg", "#example-canvas", function () {
this.brightness(brightness);
this.render(function () {
check = this.toBase64();
});但如果我这么做了我就不能打电话了。所以我试了一下:
function icancall()
{
Caman("25-02-2014_16-37-13.jpg", "#example-canvas", function () {
this.brightness(brightness);
this.render(function () {
check = this.toBase64();
});
}所以我想我可以用icancall()来调用它;但是什么也没发生。我做错了什么?我想要做的是:在单击按钮时执行Caman函数。
我希望你能帮助我!
发布于 2014-07-28 17:58:53
function resz(){
Caman("25-02-2014_16-37-13.jpg", "#example-canvas", function () {
try {
this.render(function () {
var image = this.toBase64();
xyz(image); // call that function where you pass filters
});
} catch (e) { alert(e) }
});}
通过此函数应用CamanJS过滤器
function xyz(image){
var filters_k = $('#filters');
filters_k.click(function (e) {
e.preventDefault();
var f = $(this);
if (f.is('.active')) {
// Apply filters only once
return false;
}
filters_k.removeClass('active');
f.addClass('active');
var effect = $.trim(f[0].id);
Caman(canvasID, img, function () {
if (effect in this) {
this.revert(false);
this[effect]();
this.render();
}
});
});
}https://stackoverflow.com/questions/22049578
复制相似问题