1
我正在嘗試將過濾器應用於圖案的圖案形狀,但收到很多錯誤。我GOOGLE了很多,但仍然找不到可行的解決方案。以下是我的代碼。問1.甚至有可能嗎?問2.如何實現它!?在fabric.js中爲圖案圖案添加過濾器
var canvas = new fabric.Canvas('c1');
var circle = new fabric.Circle({
radius: 100, fill: 'green', left: 100, top: 100
});
canvas.add(circle);
loadPattern('http://i0.wp.com/www.illustratoring.com/wp-content/uploads/2012/12/chevron-pattern-illustrator.png?resize=40%2C40', circle);
function loadPattern(url, obj){
fabric.util.loadImage(url, function(img) {
obj.setPatternFill({
source: img,
repeat: 'repeat'
});
canvas.renderAll();
});
}
這裏是JSfilddle https://jsfiddle.net/eepmzy9n/2/我想申請過濾器圖案圖像。